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()

     

  • 相关阅读:
    shell getopt getopts获取参数
    apache+svn+ladp认证
    SVN 迁移项目分支
    iptables 优先级
    很实用的一篇HTTP状态码
    套路还在——矩阵计算估值
    CU上看到的一个简单的算法帖子
    linux下服务端实现公网数据转发
    c++接口实现与分离(转载)
    c++继承概念
  • 原文地址:https://www.cnblogs.com/zhulvbo/p/8964512.html
Copyright © 2011-2022 走看看