-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Ensure polar plot radial lower limit remains at 0 after set_rticks + plot #29798
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
Changes from all commits
88a4424
5964c42
273dff3
c142cfa
e9817d2
faa0515
42f1d0b
2d7541c
52107b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1292,7 +1292,10 @@ def set_rscale(self, *args, **kwargs): | |
return Axes.set_yscale(self, *args, **kwargs) | ||
|
||
def set_rticks(self, *args, **kwargs): | ||
return Axes.set_yticks(self, *args, **kwargs) | ||
result = Axes.set_yticks(self, *args, **kwargs) | ||
self.yaxis.set_major_locator( | ||
self.RadialLocator(self.yaxis.get_major_locator(), self)) | ||
Comment on lines
+1296
to
+1297
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While this solves the particuar issue, I'm unclear whether this is the right fix:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that if someone calls import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from matplotlib.projections.polar import RadialLocator
import numpy as np
dates = np.arange('2025-01-01', '2027-01-01', dtype='datetime64[D]')
theta = np.linspace(0, np.pi * 4, 365 * 2)
fig, ax = plt.subplots(subplot_kw=dict(projection='polar'))
ax.plot(theta, dates)
ax.set_title('Default Ticks')
fig, ax = plt.subplots(subplot_kw=dict(projection='polar'))
ax.yaxis.set_major_locator(mdates.YearLocator())
ax.plot(theta, dates)
ax.set_title('Year Locator')
fig, ax = plt.subplots(subplot_kw=dict(projection='polar'))
ax.yaxis.set_major_locator(RadialLocator(mdates.YearLocator(), ax))
ax.plot(theta, dates)
ax.set_title('Year Locator wrapped with RadialLocator')
plt.show() I think setting fig, ax = plt.subplots(subplot_kw=dict(projection='polar'))
ax.set_rticks(dates[::200])
ax.yaxis_date()
ax.plot(theta, dates)
ax.set_title('Set ticks') |
||
return result | ||
|
||
def set_thetagrids(self, angles, labels=None, fmt=None, **kwargs): | ||
""" | ||
|
Uh oh!
There was an error while loading. Please reload this page.