process csv in matplotlib
来源:互联网 发布:python argv 编辑:程序博客网 时间:2024/06/06 00:01
import csvfrom matplotlib import pyplot as pltfrom datetime import datetimefilename = 'death_valley_2014.csv'with open(filename) as f: reader = csv.reader(f) header_row = next(reader) dates,highs,lows=[],[],[] for row in reader: try: current_date=datetime.strptime(row[0],'%Y-%m-%d') high = int(row[1]) low = int(row[3]) except ValueError: print(current_date,'missing data') else: lows.append(low) highs.append(high) dates.append(current_date) fig = plt.figure(dpi=128,figsize=(10,6)) #alpha assign the transparency plt.plot(dates,highs,c='red',alpha=0.5) plt.plot(dates,lows,c='blue',alpha=0.5) plt.fill_between(dates,highs,lows,facecolor='blue',alpha=0.1) plt.title("Daily high and low temperature, 2014",fontsize = 24) plt.xlabel("",fontsize =16) #avoid to be covered fig.autofmt_xdate() plt.ylabel('Temperature(F)',fontsize = 16) plt.tick_params(axis='both',which='major',labelsize = 16) plt.show()
阅读全文
0 0
- process csv in matplotlib
- Show image in matplotlib
- CSV processing in Ruby
- Process management in Linux
- Process in Shell
- kill process in linux
- process json in pygal
- detach process in nodejs
- python : pandas 读取csv 文件, matplotlib 画基金净值线
- sd--salea process in sd
- sd--salea process in sd
- QP:Error in formula process...
- Build process in Windows Mobile
- Build Process in Windows mobile
- operation now in process 问题;
- Build process in Windows Mobile
- UPRMS1 Process in Message Solving
- 在制品,work in process
- 大数据环境部署-1-从安装虚机到配置本地yum
- JDBC
- iOS-AotuLayout实现与理解
- static变量与函数
- JAVA 反射机制(Java Reflection)总结(一)
- process csv in matplotlib
- STP生成树协议
- 混控
- 排序--冒泡排序
- 数据结构——二叉树
- PHP实现各种经典算法
- java线程的中断
- Android Monkey测试入门-2-ADB安装和卸载命令
- 第九篇:JAVA常用类之Math