风玫瑰的自定义缩放 python

custom scaling of wind rose python

我正在尝试比较 python 中的风向图,但这很困难,因为我不知道如何在所有地块上制作相同的比例。其他人在这里 Custom percentage scale used by windrose.py 问了同样的问题,但没有人回答。

示例代码:

from windrose import WindroseAxes
import numpy as np
import matplotlib.pyplot as plt

wind_dir = np.array([30,45,90,43,180])
wind_sd = np.arange(1,wind_dir.shape[0]+1)
bins_range = np.arange(1,6,1) # this sets the legend scale
fig,ax = plt.subplots()
ax = WindroseAxes.from_ax()

bin_range 下面设置条形比例,但我需要更改 y 轴频率比例,以便与其他具有不同数据的风玫瑰进行比较。

ax.bar(wind_dir,wind_sd,normed=True,bins=bins_range) 

这个 set_ylim 似乎有效,但 yaxis 刻度没有改变

ax.set_ylim(0,50)

下面这 set_ticks 行没有做任何事情,我不知道为什么

ax.yaxis.set_ticks(np.arange(0,50,10))

ax.set_legend()
plt.show()
from windrose import WindroseAxes
import numpy as np
import matplotlib.pyplot as plt

wind_dir = np.array([30,45,90,43,180])
wind_sd = np.arange(1,wind_dir.shape[0]+1)
bins_range = np.arange(1,6,1) # this sets the legend scale

ax = WindroseAxes.from_ax()
ax.bar(wind_dir,wind_sd,normed=True,bins=bins_range)
ax.set_yticks(np.arange(10, 60, step=10))
ax.set_yticklabels(np.arange(10, 60, step=10))
plt.show()