气象数据纬向风绘图:
纬向风:沿东经111度,纬度0到60度,气压1000hPa到50hPa,纵坐标按照等压面对应高度绘图,
#data
uwind1 = xr.DataArray(uwind[12:68:12,:,0:61,111], #创建新的xarray
coords=[times[12+N:68:12],levels,lats[0:61]],
dims=['times','等压面','纬度'])
#绘图
#RC设置参数:https://proplot.readthedocs.io/en/latest/configuration.html#ug-config
with plot.rc.context({'font.name':'SimHei',
'suptitle.size': 18,
'tick.labelsize':12,
'text.labelsize':15,
'legend.fontsize':10,
'abc.size':15,
'title.size':15,
'title.loc':'c',
},
#abc=True,
#abcstyle='(a)',
#abcloc = 'u',
linewidth=1.5):
fig,ax = plot.subplots([[1,2,3],
[4,5,0]],
ref=1,
#nrows=2,ncols=5,
figsize=(8,8),
share=1,
)
ax.format(suptitle='纬向平均风速\n',
xlim=(0,60), xlocator=20, #xformatter='deglon')
clevel = np.arange(-48,57,8)
for i in range(5):
m=ax[i].contourf(uwind1[i,8:,:],cmap='DryWet',
levels=clevel,
extend='both',
linewidth=0.7,labels=True,color='k')
ax[i].format(title=str(uwind1.times.values[i])[0:7],
yscale='height',
#yscale='height', p坐标系按照度应高度画图,详见#https://proplot.readthedocs.io/en/latest/api/proplot.constructor.Scale.html?highlight=yscale
ylocator=[1000,850,700,500,200,100,50]
#yreverse=True, #使用yscale后,yreverse不起作用
)
ax[i].invert_yaxis() #yreverse不起作用,使用invert_yaxis可以实现
#ax.colorbar(m,loc='r')
plot.rc.reset()
path = 'C:\\Users\\Administrator\\Desktop\\纬向风速1月.svg'
fig.save(path)