Python Windrose 90 度偏离和错误标签

Bob*_*Bob 5 python matplotlib

我正在使用 Windrose.py,但没有得到与其他人相同的示例结果。我在图像的顶部得到了 90,而不是顶部的“N”。我每个方向都有多个风速。我首先在一个方向上测试绘图。我不知道如何绘制其他 350 度。该图并未显示风向阵列状态下的 10 度角。这是代码:

from windrose import WindroseAxes
from matplotlib import pyplot as plt
import matplotlib.cm as cm
import numpy as np
from matplotlib.projections import register_projection

register_projection(WindroseAxes)

ws = [1.81,1.58,0.09,0.11,0.01]
wd = [10,10,10,10,10]
ws_array = np.array(ws)
wd_array = np.array(wd)

ax = WindroseAxes.from_ax()
ax.bar(wd_array, ws_array, normed=True, opening=1.0, edgecolor='white')

color_s = ['red', 'blue', 'lime', 'yellow', 'violet', 'aqua', 'pink', 'grey', 'darkred', 'navy', 'green']
ax.set_legend(title = 'Wind Speed in Knots', bbox_to_anchor=(1.05, 1), loc='upper left', handles = color_s, borderaxespad=0.)

Run Code Online (Sandbox Code Playgroud)

这是情节: 在此输入图像描述

小智 2

我有同样的问题,刚刚安装了windrose,1.6.8版本,我设法做了一个解决方法:

ax.set_xticklabels(['N', 'NW',  'W', 'SW', 'S', 'SE','E', 'NE'])
ax.set_theta_zero_location('N')
Run Code Online (Sandbox Code Playgroud)

  • 我在第一行赞成这一点,但对我来说,“ax.set_theta_zero_location”搞砸了数据方向 (2认同)