windrose
windrose copied to clipboard
Ticks on the r axes
I recently discovered your very nice little package, and I really appreciate it. I am using it for pollution roses in an air quality study, and it works quite well.
I did figure out how to move the legend out of the rose through a direct call to the matplotlib functions underneath:
ax.legend(title="Ozone (ppbv)", loc=(1.2,0))
and how to put titles through the same method: plt.title('Pollution rose at a receptor site', y=1.08)
yet, I am having a very hard time with ticks on the r-axis. no matter what I try to do, I can't force them to be on rounded values.
I tried through : ax.set_yticks(np.arange(0,25,5)), but it keeps putting some kind of offset (typically .2, see attached example)
so I worked around the problem with a formatting solution:
import matplotlib.ticker as tkr
ax.yaxis.set_major_formatter(tkr.FormatStrFormatter('%2.0f'))
but I think there should be a better way to do that. did I miss something ?
thanks for your help

Merci pour le compliment et ravi que Windrose serve à d'autres depuis que je l'ai mis sur GitHub et packagé. Je suis actuellement en vacance et n'ai pas trop le temps de répondre mais je ne suis pas choqué par la méthode. Je ne suis pas non plus un spécialiste de Matplotlib... il faut faire des essais et essayer d'intégrer le code dans la bibliothèque (sans que cela n'ai d'effet de bord) et soumettre un pull request
I think the issue is solved, according to this minimum example:
import numpy as np
import matplotlib.pyplot as plt
import windrose
ws = np.random.random(500) * 6
wd = np.random.random(500) * 360
ax = windrose.WindroseAxes.from_ax()
ax.bar(wd, ws)
ax.set_yticks(np.arange(0, 46, 5))
# don't forget to also change the labels
ax.set_yticklabels(np.arange(0, 46, 5))

Closing this as answered. Please feel free to reopen you disagree.