【发布时间】:2019-11-25 19:05:14
【问题描述】:
我想用 wrscatter 图覆盖使用 contourf() 制作的风玫瑰图。 这是我的 MWE:
import random
wind_dir = []; wind_speed = [];
for i in range(30):
wind_dir.extend(random.sample(range(0, 359),1))
wind_speed.extend(random.sample(range(0, 10),1))
import windrose
wd1 = np.radians([0, 45, 90, 135, 180, 225, 270, 315])
ws = [1.0, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.95]
vf = np.vectorize(lambda wd: -wd + np.pi / 2)
wd = vf(wd1)
fig = plt.figure()
from windrose import WindroseAxes
plt.figure(figsize=(15,12))
ax = WindroseAxes.from_ax()
ax.contourf(wind_dir,wind_speed, bins=np.arange(0, 8, 1))
ax.set_legend()
windrose.wrscatter(wd, ws)
plt.legend(loc='center left', bbox_to_anchor=(1, 0.5),prop={'size': 20})
plt.show()
现在这两个情节是分开的,但我希望它们重叠在一个情节中。 感谢您的帮助!
【问题讨论】: