# owner:@aviviguixiang
# createtime:2019/7/22
# 任务:芒市20190326—20190328、20190330—20190401气象场、监测数据逐时折线
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.font_manager as fm
zhfont1 = fm.FontProperties(fname=r'D:pycharm_project190325 aihexiandataSIMKAI.TTF')
def draw(data,a,b,p1,p2,p3,p4,p5,p6):
fig,(ax00, ax10, ax20, ax30) = plt.subplots(4, 1, sharex=True,figsize=(10, 11))
# fig, ax = plt.subplots(4, 1, figsize=(10, 11))
ax00 .plot(data.loc[a:b,p1].values,'k-',linewidth=2)
ax00.set_ylabel(r'温度(℃)',fontproperties=zhfont1,size=12)
ax10 .plot(data.loc[a:b,p2].values,'k-',linewidth=2)
ax10.set_ylabel(r'十米风速(m/s)', fontproperties=zhfont1, size=12)
ax20 .plot(data.loc[a:b,p3].values,'k-',linewidth=2)
ax20.set_ylabel(r'气压(hPa)', fontproperties=zhfont1, size=12)
ax30 .plot(data.loc[a:b,p4].values,'k-',linewidth=2)
ax30.set_ylabel(r'相对湿度(%)', fontproperties=zhfont1, size=12)
x_lable=list(data.loc[a:b,p6].values[0:72:10])
print(x_lable)
# x_lable.append(data.loc[a:b,p6].values[0])
new_x=sorted(x_lable)
print(type(new_x))
plt.xlim(0,71)
ax30.set_xlabel('日期', fontproperties=zhfont1, size=12)
ax30.set_xticklabels(new_x, fontproperties=zhfont1, size=12)
print(new_x)
plt.savefig(r'D:pycharm_project1205mangshipngqi_2.png')
plt.show()
def draw_1(data,a,b,p1,p2,p3,p4,p5,p6):
fig,(ax00, ax10, ax20, ax30,ax40) = plt.subplots(5, 1, sharex=True,figsize=(10, 11))
# fig, ax = plt.subplots(4, 1, figsize=(10, 11))
ax00 .plot(data.loc[a:b,p1].values,'k-',linewidth=2)
ax00.set_ylabel(r'$PM_{2.5}$'+r'($mu{g/m}^{3}$)',fontproperties=zhfont1,size=12)
ax10 .plot(data.loc[a:b,p2].values,'k-',linewidth=2)
ax10.set_ylabel(r'$PM_{10}$'+r'($mu{g/m}^{3}$)', fontproperties=zhfont1, size=12)
ax20 .plot(data.loc[a:b,p3].values,'k-',linewidth=2)
ax20.set_ylabel(r'CO'+r'($m{g/m}^{3}$)', fontproperties=zhfont1, size=12)
ax30 .plot(data.loc[a:b,p4].values,'k-',linewidth=2)
ax30.set_ylabel(r'$SO_{2}$'+r'($mu{g/m}^{3}$)',