import pandas as pd
data_mean=pd.read_excel('three_year_mean.xlsx')
data_std=pd.read_excel('three_year_std.xlsx')
mean1=data_mean['2019_pm25']
std1=data_std['2019_pm25']
mean2=data_mean['2020_pm25']
std2=data_std['2020_pm25']
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import matplotlib as mpl
import matplotlib.font_manager as font_manager
mpl.rcParams["font.family"] = 'Times New Roman'
mpl.rcParams["mathtext.fontset"] = 'cm'
mpl.rcParams["font.size"] = 20
mpl.rcParams["axes.linewidth"] = 1.5
font = {'family' : 'Times New Roman',
'color' : 'black',
'weight' : 'normal',
'size' : 25,
}
font1 = font_manager.FontProperties(family='Times New Roman',weight='bold',style='normal', size=20)
fig, ax = plt.subplots(figsize=(12.8,4))
x=data_mean['date']
ymin=mean1-2*std1
ymax=mean1+2*std1
ymean=mean1
ymin1=mean2-2*std2
ymax1=mean2+2*std2
ymean1=mean2
line75=np.ones(len(x))*75
plt.plot(x, ymin, 'b',marker='.',markersize=0.0, linewidth=0.0)
plt.plot(x, ymax, 'b',marker='.',markersize=0.0, linewidth=0.0)
plt.fill_between(x,ymin,ymax,color="#ffdee1",alpha=0.6)
plt.plot(x, ymean, '#fc0402',marker='o',markersize=0, linewidth=3,label='2019')
plt.plot(x, ymin1, 'b',marker='.',markersize=0.0, linewidth=0.0)
plt.plot(x, ymax1, 'b',marker='.',markersize=0.0, linewidth=0.0)
plt.fill_between(x,ymin1,ymax1,color="#a1dfff",alpha=0.6)
plt.plot(x, ymean1, '#56baf1',marker='o',markersize=0, linewidth=3,label='2020')
plt.plot(x, line75, 'k',linestyle='dashed', linewidth=1,label='75 $\mathbf{ ug/m^3}$')
label=['Jan 16', 'Jan 26', 'Feb 5', 'Feb 15','Feb 25', 'Mar 6', 'Mar 16', 'Mar 26']
plt.xticks(pd.date_range('2020-1-16','2020-3-31',freq='10d'),label)
plt.tick_params(which='major',length=6,width=2)
plt.ylim(0,220)
plt.legend(frameon=False,prop=font1)
plt.savefig('Region.jpg',dpi=300)
|