Skip to content

Commit 757cf5b

Browse files
committed
Deprecate redundant axes parameter to RadialLocator.
We can just directly fetch the relevant information from `locator.axis.axes`; the case where `locator.axis.axes` was different from `axes` was not tested and doesn't make much sense anyways. The change also goes in the direction of having Locators carry less state (and hopefully, in the future, not being associated with an axis, but rather having the axis passed as argument to `__call__`).
1 parent 1f8ff33 commit 757cf5b

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
The *axes* parameter of ``RadialLocator``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
... is deprecated. `~.polar.RadialLocator` now fetches the relevant information
4+
from the Axis' parent Axes.

lib/matplotlib/projections/polar.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ class RadialLocator(mticker.Locator):
431431
scale of the *r*-axis).
432432
"""
433433

434+
@_api.delete_parameter("3.11", "axes")
434435
def __init__(self, base, axes=None):
435436
self.base = base
436437
self._axes = axes
@@ -440,19 +441,19 @@ def set_axis(self, axis):
440441

441442
def __call__(self):
442443
# Ensure previous behaviour with full circle non-annular views.
443-
if self._axes:
444-
if _is_full_circle_rad(*self._axes.viewLim.intervalx):
445-
rorigin = self._axes.get_rorigin() * self._axes.get_rsign()
446-
if self._axes.get_rmin() <= rorigin:
447-
return [tick for tick in self.base() if tick > rorigin]
444+
ax = self.base.axis.axes
445+
if _is_full_circle_rad(*ax.viewLim.intervalx):
446+
rorigin = ax.get_rorigin() * ax.get_rsign()
447+
if ax.get_rmin() <= rorigin:
448+
return [tick for tick in self.base() if tick > rorigin]
448449
return self.base()
449450

450451
def _zero_in_bounds(self):
451452
"""
452453
Return True if zero is within the valid values for the
453454
scale of the radial axis.
454455
"""
455-
vmin, vmax = self._axes.yaxis._scale.limit_range_for_scale(0, 1, 1e-5)
456+
vmin, vmax = self.base.axis._scale.limit_range_for_scale(0, 1, 1e-5)
456457
return vmin == 0
457458

458459
def nonsingular(self, vmin, vmax):
@@ -681,7 +682,7 @@ def __init__(self, *args, **kwargs):
681682

682683
def set_major_locator(self, locator):
683684
if not isinstance(locator, RadialLocator):
684-
locator = RadialLocator(locator, self.axes)
685+
locator = RadialLocator(locator)
685686
super().set_major_locator(locator)
686687

687688
def clear(self):

0 commit comments

Comments
 (0)