Skip to content

Address matplotlib user warning on wind rose plot#608

Merged
rafmudaf merged 1 commit intoNatLabRockies:developfrom
pablo-benito:bugfix/supress-matplotlib-warning
Mar 20, 2023
Merged

Address matplotlib user warning on wind rose plot#608
rafmudaf merged 1 commit intoNatLabRockies:developfrom
pablo-benito:bugfix/supress-matplotlib-warning

Conversation

@pablo-benito
Copy link
Contributor

Supress matplotlib UserWarning on wind rose plot

The WindRose functions plot_wind_rose and plot_wind_rose_ti triggers a matplotlib UserWarning.

Example code:

from floris.tools.wind_rose import WindRose
import matplotlib.pylab as plt

wr = WindRose()
wr.make_wind_rose_from_user_data([1,2,3], [4,5,6])
wr.plot_wind_rose()

plt.show()

Output:

Correcting negative Overhang:-2.5
Correcting negative Overhang:-7.5
wind_rose.py:1481: UserWarning: FixedFormatter should only be used together with FixedLocator

This pull request removes this warning by explicitly setting the ticks associated with the windrose labels.

Related issue

None

Impacted areas of the software

wind_rose.py

Additional supporting information

Matplotlib issue, with a similar question about this UserWarning: matplotlib/matplotlib#18848

Test results, if applicable

@Bartdoekemeijer
Copy link
Collaborator

Nice find, the PR looks good to me! And good to see you around here @pablo-benito!!

@rafmudaf rafmudaf self-requested a review March 20, 2023 15:16
@rafmudaf rafmudaf added enhancement An improvement of an existing feature floris.tools labels Mar 20, 2023
@rafmudaf
Copy link
Collaborator

Well done @pablo-benito, thanks for the contribution!

@rafmudaf rafmudaf merged commit e9231fb into NatLabRockies:develop Mar 20, 2023
@rafmudaf rafmudaf changed the title Supress matplotlib user warning on wind rose plot Address matplotlib user warning on wind rose plot Mar 20, 2023
@pablo-benito pablo-benito deleted the bugfix/supress-matplotlib-warning branch September 11, 2023 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement An improvement of an existing feature floris.tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants