-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wind rose axis #151
Comments
Duplicate of #147 ? |
I see the same thing and numbers not directions are labeled. I had to add the axes presumably setting the '0' to E as compensation but the labeling seems off by 90° as noted above.
|
This is an important issue in which the theta labels in windrose are incorrect. for solving it you can type this line in your code.
|
Complete code after solution: from windrose import WindroseAxes
from matplotlib import pyplot as plt
import matplotlib.cm as cm
import numpy as np
plt.figure()
ws = np.random.random(500) * 25
wd = np.random.random(500) * 360
ax = WindroseAxes.from_ax()
plt.style.use('fast')
ax.bar(wd, ws, nsector= 36,opening=0.94, bins=np.arange(0, 31, 5),edgecolor='gray',lw=0.1)
ax.set_xticklabels([90, 45, 0, 315, 270, 225, 180, 135])
ax.set_legend()
ax.set_title("Wind Rose")
plt.show() |
And for having all the grids and numbers every 10 degrees you can use this improved version: from windrose import WindroseAxes
from matplotlib import pyplot as plt
import matplotlib.cm as cm
import numpy as np
plt.figure()
ws = np.random.random(500) * 25
wd = np.random.random(500) * 360
ax = WindroseAxes.from_ax()
plt.style.use('fast')
ax.bar(wd, ws, nsector= 36,opening=0.94, bins=np.arange(0, 31, 5),edgecolor='gray',lw=0.1)
ax.set_thetagrids(range(0,360,10),[90, 80, 70, 60, 50, 40, 30, 20, 10, 0, 350, 340, 330, 320, 310, 300, 290, 280, 270, 260, 250, 240, 230, 220, 210, 200, 190, 180, 170, 160, 150, 140, 130, 120, 110, 100])
ax.set_theta_zero_location('W', offset=-90)
ax.set_theta_direction(-1)
ax.set_legend()
ax.set_title("Wind Rose")
plt.show() |
@FFT1368 Thank you for your post, I encountered this same issue and fixed it myself, only thinking ofo coming to the known issues section after the fact :/ In your solution, are you keeping the 'W' direction at the theta = 0 location on the polar plot? What is your reason for doing this? Another solution would be to set the theta_zero_location to 'N' and then make the offset=0, with the direction going clockwise of course. Code below (incomplete code, showing only additions to the 'usual' windrose plot things): Is there a reason you did not go this route that I am missing? I'm thinking there might be issues with the labels only moving with the data remaining plotted in the same locations for instance. Otherwise if it works the same then 'N' in the theta=0 location would be preferable right? |
@swartmilan from windrose import WindroseAxes
from matplotlib import pyplot as plt
import matplotlib.cm as cm
import numpy as np
ws = np.random.random(500) * 25
wd = np.random.random(500) * 360
ax = WindroseAxes.from_ax()
plt.style.use('fast')
ax.bar(wd, ws, nsector= 36,opening=0.94, bins=np.arange(0, 31, 5),edgecolor='gray',lw=0.1)
ax.set_thetagrids(range(0,360,10),[90, 80, 70, 60, 50, 40, 30, 20, 10, 0, 350, 340, 330, 320, 310, 300, 290, 280, 270, 260, 250, 240, 230, 220, 210, 200, 190, 180, 170, 160, 150, 140, 130, 120, 110, 100])
ax.set_theta_zero_location('W', offset=-180)
ax.set_legend(loc=(-0.08, -0.08))
ax.set_title("Wind Rose")
plt.show() |
Hello @FFT1368, I was wondering which parameters control the values of the frequency ? to have them spaced evenly ? in this picture for example. Thank you in advance |
@FFT1368 Thank you for responding! @cheikhnatm I think you can go into the windrose.py package where it is installed locally and change the radii label spacing where it calculates it radii=np.linspace(0, rmax, N + 1)
let me know if this works please :) |
This was fixed in #165 Please open a new issue if this resurfaces. |
|
How do you mentioned the % value as a normed/frequency ? thank you in advance |
I had a similar issue as the original poster. This solution did help (I needed to remove the Instead of constructing the list myself I wrote it into a List Comprehension: so combined it looks like: |
@robertburry this is a closed issue but your comment/code is nice and valid. Do you mind opening a new one with the updated info? |
Hi,
It seems that the default directions along the axis circle is not correct anymore. 0° pointing to East
To use the example in the example notebook:
The text was updated successfully, but these errors were encountered: