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

Default behavior of theta_labels in WindroseAxes.from_ax() is not user-friendly. #165

Closed
15b3 opened this issue Oct 26, 2021 · 0 comments · Fixed by #166
Closed

Default behavior of theta_labels in WindroseAxes.from_ax() is not user-friendly. #165

15b3 opened this issue Oct 26, 2021 · 0 comments · Fixed by #166

Comments

@15b3
Copy link
Contributor

15b3 commented Oct 26, 2021

Since v1.6.8, the default behavior of theta_labels in WindroseAxes.from_ax() is not user-friendly.

The results of running Tutorial's code ( that is, using the WindroseAxes.from_ax()) in #147 and #151, show that the label of theta is the default of matplotlib, not the default of windrose.

In #140, the implementation of theta_labels has been changed as follows.

“Pop and or"(Before):

self.theta_labels = kwargs.pop(“theta_labels”) or ["E", "N-E", "N", "N-W", "W", "S-W", "S", "S-E"])

“Pop only"(After):

self.theta_labels = kwargs.pop("theta_labels", ["E", "N-E", "N", "N-W", "W", "S-W", "S", "S-E"])

Let us consider the following three cases.

  1. kwargs in __init__ method has theta_labels key and its value is None.
  2. kwargs in __init__ method has theta_labels key and its value is user's custom labels.
  3. kwargs in __init__ method doesn't have theta_labels key itself.

"Pop and or" returns:

  1. ["E", "N-E", "N", "N-W", "W", "S-W", "S", "S-E"]
  2. user's custom labels
  3. KeyError is raised.

"Pop only" returns:

  1. None
  2. user's custom labels
  3. ["E", "N-E", "N", "N-W", "W", "S-W", "S", "S-E"]

Maybe #140 was trying to fix the KeyError in case 3. But unfortunately, the behavior of the case 1 has also changed.

If we call WindroseAxes.from_ax() with the default values, the function will call the WindroseAxes's constructor in the 1 case (See L88 and L102). Since None is passed to matplotlib, the theta labels will be the default values of matplotlib.

I believe the following is the user-friendly behavior:

  1. ["E", "N-E", "N", "N-W", "W", "S-W", "S", "S-E"].
  2. user's custom labels. (this is, kwargs["theta_labels"])
  3. ["E", "N-E", "N", "N-W", "W", "S-W", "S", "S-E”].
@15b3 15b3 changed the title Default behavior of theta_labels in WindroseAxis.from_ax() is not user-friendly. Default behavior of theta_labels in WindroseAxes.from_ax() is not user-friendly. Oct 26, 2021
This was referenced May 6, 2022
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.

1 participant