Skip to content
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

windrose plot sectors show straight line instead of curved ones #137

Closed
yngwaz opened this issue Aug 4, 2020 · 4 comments · Fixed by #266
Closed

windrose plot sectors show straight line instead of curved ones #137

yngwaz opened this issue Aug 4, 2020 · 4 comments · Fixed by #266

Comments

@yngwaz
Copy link

yngwaz commented Aug 4, 2020

Following the minimal example of https://windrose.readthedocs.io/en/latest/usage.html#script-example
I obtain a windrose plot which shows a straight line for each sector (instead of a curved one).

Figure_1

Same happens for more elaborate examples.
However, following the sample script for a polar bar chart from matplotlib:
https://matplotlib.org/3.2.1/gallery/pie_and_polar_charts/polar_bar.html#sphx-glr-gallery-pie-and-polar-charts-polar-bar-py
I do get the rounded/curved sectors.

I am using:
windrose 1.6.7 pypi_0 pypi
python 3.8.5 h425cb1d_1_cpython conda-forge
matplotlib-base 3.3.0 py38h91b0d89_1 conda-forge

Any ideas why this is happening?
Many thanks!

@yngwaz
Copy link
Author

yngwaz commented Aug 4, 2020

The workaround for this issue (found by my colleague at work) is as follows:

fig = plt.figure()
rect = [0.1, 0.1, 0.8, 0.8]
hist_ax = plt.Axes(fig,rect)
hist_ax.bar(np.array([1]), np.array([1]))
# only after creating the dummy axes above, the windrose will plot curved sectors!

ax = WindroseAxes.from_ax()   

ax.bar(wd, ws, normed=True, opening=0.8, edgecolor='white')
ax.set_legend()

wr_plot

@ocefpaf
Copy link
Collaborator

ocefpaf commented Sep 21, 2022

Closing this as answered. Please re-open if you disagree.

@ocefpaf ocefpaf closed this as completed Sep 21, 2022
@jkittner
Copy link
Contributor

Mhm, I'm running into the same issue while writing tests using a baseline image and comparing results to it. I got random fails and was wondering why this was the case.

Turns out if the tests runs first, the sectors will have square ends, if it runs after any other test that involves plotting, it succeeds.

So for some reason we need to run some plotting before, so it gets the rounded results -- I have no idea how to debug this though. Something is different with either the object or the global state.

Since this causes inconsistent behavior, I'd consider this a bug we should address or at least find out what's going on...

I'll dig deeper into this and let you know if I come across anything...

@jkittner
Copy link
Contributor

@yngwaz - I created #266 that fixes the issue for me. Maybe you can try if that also works for you, and you can remove your workaround?

@ocefpaf ocefpaf reopened this Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants