用浓度容器绘制风玫瑰

时间:2020-07-07 20:19:17

标签: python numpy matplotlib

不久前,我提出了另一个问题,但此后尝试使用另一种技术绘制风玫瑰污染图。但是,我仍然对此有疑问。我从this post中找到了该技术的模板,我不确定我的说明在哪里出问题,并且得到了一个奇怪的图。

对我要去哪里的任何帮助将不胜感激!

这是代码:

wd = list(merge_all_apr['Wind Dir (10s deg)'])
conc = list(merge_all_apr['Mean_CO2'])
ws = list(merge_all_apr['Wind Spd (km/h)'])

wd_rad = np.radians(np.array(wd))

wind_dir, wind_speed = np.meshgrid(wd_rad, ws)

C = np.sinc(wind_dir-2)+(5-np.sqrt(wind_speed))+conc
C = np.ma.masked_less_equal(C,2)


fig, ax = plt.subplots(figsize=(20, 10), subplot_kw={"projection": "polar"})
cmap = plt.get_cmap('jet')
img = ax.pcolormesh(wind_dir, wind_speed, C, cmap=cmap, vmin=0, vmax=20, alpha = 0.70)
ax.set_theta_zero_location('N')
ax.set_theta_direction(-1) 
ax.set_ylim(0,50)

ax.set_yticks(np.arange(0,50,5))

#move yticks to different radial position
ax.set_rlabel_position(40)

plt.colorbar(img)
plt.show()

这是情节的结果: (https://stackoverflow.com/image.jpg)

0 个答案:

没有答案