zoukankan      html  css  js  c++  java
  • 项目 数据可视化6

     1 import csv
     2 
     3 from matplotlib import pyplot as plt
     4 
     5 filename = 'sitka_weather_07-2014.csv'
     6 
     7 with open(filename) as f:
     8     reader = csv.reader(f)
     9     header_row = next(reader)
    10     
    11 
    12     highs =[]
    13     for row in reader:
    14         high = int(row[1])
    15         highs.append(high)
    16 
    17 
    18 fig = plt.figure(dpi=128,figsize=(10,6))
    19 plt.plot(highs,c='red')
    20 
    21 plt.title("Daoly high temperatures,July 2014",fontsize=24)
    22 plt.xlabel("",fontsize=16)
    23 plt.ylabel("Temperature(F)",fontsize=16)
    24 plt.tick_params(axis='both',which='major',labelsize=16)
    25 
    26 plt.show()

     import csv
    from datetime import datetime

    from matplotlib import pyplot as plt

    filename = 'sitka_weather_07-2014.csv'

    with open(filename) as f:
        reader = csv.reader(f)
        header_row = next(reader)
        
        dates,highs=[],[]

        for row in reader:
            current_date = datetime.strptime(row[0], "%Y-%m-%d")
            dates.append(current_date)
            high = int(row[1])
            highs.append(high)


    fig = plt.figure(dpi=128,figsize=(10,6))
    plt.plot(dates,highs,c='red')

    plt.title("Daoly high temperatures,July 2014",fontsize=24)
    plt.xlabel("",fontsize=16)
    fig.autofmt_xdate()
    plt.ylabel("Temperature(F)",fontsize=16)
    plt.tick_params(axis='both',which='major',labelsize=16)

    plt.show()

     

  • 相关阅读:
    elasticsearch 基本操作
    ElasticSearch停止启动
    oracle误删数据
    多层级sql查询
    max_result_window
    测试ik分词效果
    TransportClient 新建index,mappings dynamic_templates。
    7.10考试
    C#生成TXT文件
    C#的进度条--progressBar
  • 原文地址:https://www.cnblogs.com/zhulvbo/p/8964512.html
Copyright © 2011-2022 走看看