You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: set_rticks makes polar autoscale move the origin away from zero #29528
On polar axes, autoscaling (which only applies on the radial direction) normally avoids moving the origin away from r=0 (unless there's negative radius data). However, this behavior is lost if set_rticks has been called first.
I think the problem is that set_rticks replaces the RadialLocator with the FixedLocator. The view_limits method on the RadialLocator is what usually keeps the origin at or below zero.
@rcomer yes. I have already altered my solution to one that uses the RadialLocator, very similar to what you proposed and it seems to work. Should i open a new PR or just commit to the branch in my fork? Sorry im not sure how it works. Thanks for the help
Activity
Fix matplotlib#29528 set_rticks makes autoscale move the origin away …
Fix matplotlib#29528 set_rticks makes autoscale move the origin away …
Fix matplotlib#29528 set_rticks makes autoscale move the origin away …
rcomer commentedon Mar 24, 2025
I think the problem is that
set_rticksreplaces theRadialLocatorwith theFixedLocator. Theview_limitsmethod on theRadialLocatoris what usually keeps the origin at or below zero.matplotlib/lib/matplotlib/projections/polar.py
Lines 506 to 511 in a9dc9ac
Do we need to implement a
RadialFixedLocator?timhoffm commentedon Mar 24, 2025
The
RadialLocatoris a wrapper around abaselocator. Would it work to setRadialLocator.baseto theFixedLocator?rcomer commentedon Mar 25, 2025
Oh, maybe we just need to call
self.yaxis._wrap_locator_formatterwithinset_rticksmatplotlib/lib/matplotlib/projections/polar.py
Lines 722 to 725 in a9dc9ac
@bruswaine do you want to give that a try?
bruswaine commentedon Mar 25, 2025
@rcomer yes. I have already altered my solution to one that uses the
RadialLocator, very similar to what you proposed and it seems to work. Should i open a new PR or just commit to the branch in my fork? Sorry im not sure how it works. Thanks for the helprcomer commentedon Mar 25, 2025
@bruswaine great - it seems you are ahead of me! It's fine to commit to your existing branch.
Fix matplotlib#29528 set_rticks makes autoscale move the origin away …
Fix matplotlib#29528 set_rticks makes autoscale move the origin away …
Ensure polar plot radial lower limit remains at 0 after set_rticks + …