如何更改WindroseAxes中的轴标签?

2024-04-27 21:41:22 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用windrose轴绘制了一个windrose,但无法找到如何将轴设置为显示方向(N、NNE、NE、NEE…),而不是度

我正在使用Jupyter笔记本,到目前为止还没有找到任何有用的提示。 这是我的密码:

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

data=np.genfromtxt("data.csv",delimiter=";")
#removing NaN-s and pulling the data from the array
ws=data[1::,2]
wd=data[1::,3]
wd1=np.nan_to_num(wd)
ws1=np.nan_to_num(ws)

ax = WindroseAxes.from_ax()
ax.bar(wd1, ws1, normed=True, opening=1, edgecolor='White', bins=[0,0.5,1.5,3.3,5.5,7.9])
ax.legend()

这是我得到的数字。在文档中,他们使用相同的代码,但轴不同

my plot

链接到文档:https://windrose.readthedocs.io/en/latest/usage.html#a-stacked-histogram-with-normed-displayed-in-percent-results


Tags: thefromimportnumpydatawsmatplotlibas