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

Add option to specify radius steps #157

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion windrose/windrose.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def __init__(self, *args, **kwargs):
PolarAxes.__init__(self, *args, **kwargs)
self.set_aspect("equal", adjustable="box", anchor="C")
self.radii_angle = 67.5
self.rstep = None
self.clear()

@staticmethod
Expand Down Expand Up @@ -150,8 +151,13 @@ def set_radii_angle(self, **kwargs):
if angle is None:
angle = self.radii_angle
self.radii_angle = angle
N = 5
rmax = self.get_rmax()
if self.rstep is not None:
rstep = self.rstep
N = np.int_(np.ceil(rmax / rstep))
rmax = N * rstep
else:
N = 5
radii = np.linspace(0, rmax, N + 1)
if rmax % N == 0:
fmt = "%d"
Expand Down Expand Up @@ -363,6 +369,8 @@ def _init_plot(self, direction, var, **kwargs):

normed = kwargs.pop("normed", False)
blowto = kwargs.pop("blowto", False)
rstep = kwargs.pop("rstep", None)
self.rstep = rstep

# Calm condition
calm_limit = kwargs.pop("calm_limit", None)
Expand Down