Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Remove Locator.autoscale. #18513

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

Merged
merged 1 commit into from
Sep 18, 2020
Merged
Show file tree
Hide file tree
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
11 changes: 11 additions & 0 deletions doc/api/next_api_changes/removals/18513-ES.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Locators
~~~~~~~~
The unused ``Locator.autoscale`` method has been removed (pass the axis limits
to `.Locator.view_limits` instead). Any derived methods are also removed:

* ``Locator.autoscale``
* ``AutoDateLocator.autoscale``
* ``RRuleLocator.autoscale``
* ``RadialLocator.autoscale``
* ``ThetaLocator.autoscale``
* ``YearLocator.autoscale``
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Deprecation of the constructor means that classes inheriting from

Locators
~~~~~~~~
The unused `.Locator.autoscale` method is deprecated (pass the axis limits to
The unused ``Locator.autoscale`` method is deprecated (pass the axis limits to
`.Locator.view_limits` instead).

Animation
Expand Down
60 changes: 0 additions & 60 deletions lib/matplotlib/dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -1194,42 +1194,6 @@ def get_unit_generic(freq):
def _get_interval(self):
return self.rule._rrule._interval

@cbook.deprecated("3.2")
def autoscale(self):
"""
Set the view limits to include the data range.
"""
dmin, dmax = self.datalim_to_dt()
delta = relativedelta(dmax, dmin)

# We need to cap at the endpoints of valid datetime
try:
start = dmin - delta
except ValueError:
start = _from_ordinalf(1.0)

try:
stop = dmax + delta
except ValueError:
# The magic number!
stop = _from_ordinalf(3652059.9999999)

self.rule.set(dtstart=start, until=stop)
dmin, dmax = self.datalim_to_dt()

vmin = self.rule.before(dmin, True)
if not vmin:
vmin = dmin

vmax = self.rule.after(dmax, True)
if not vmax:
vmax = dmax

vmin = date2num(vmin)
vmax = date2num(vmax)

return self.nonsingular(vmin, vmax)


class AutoDateLocator(DateLocator):
"""
Expand Down Expand Up @@ -1363,12 +1327,6 @@ def _get_unit(self):
else:
return RRuleLocator.get_unit_generic(self._freq)

@cbook.deprecated("3.2")
def autoscale(self):
"""Try to choose the view limits intelligently."""
dmin, dmax = self.datalim_to_dt()
return self.get_locator(dmin, dmax).autoscale()

def get_locator(self, dmin, dmax):
"""Pick the best locator based on a distance."""
delta = relativedelta(dmax, dmin)
Expand Down Expand Up @@ -1538,24 +1496,6 @@ def tick_values(self, vmin, vmax):

ticks.append(dt)

@cbook.deprecated("3.2")
def autoscale(self):
"""
Set the view limits to include the data range.
"""
dmin, dmax = self.datalim_to_dt()

ymin = self.base.le(dmin.year)
ymax = self.base.ge(dmax.year)
vmin = dmin.replace(year=ymin, **self.replaced)
vmin = vmin.astimezone(self.tz)
vmax = dmax.replace(year=ymax, **self.replaced)
vmax = vmax.astimezone(self.tz)

vmin = date2num(vmin)
vmax = date2num(vmax)
return self.nonsingular(vmin, vmax)


class MonthLocator(RRuleLocator):
"""
Expand Down
8 changes: 0 additions & 8 deletions lib/matplotlib/projections/polar.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,6 @@ def __call__(self):
else:
return np.deg2rad(self.base())

@cbook.deprecated("3.2")
def autoscale(self):
return self.base.autoscale()

@cbook.deprecated("3.3")
def pan(self, numsteps):
return self.base.pan(numsteps)
Expand Down Expand Up @@ -431,10 +427,6 @@ def __call__(self):
else:
return [tick for tick in self.base() if tick > rorigin]

@cbook.deprecated("3.2")
def autoscale(self):
return self.base.autoscale()

@cbook.deprecated("3.3")
def pan(self, numsteps):
return self.base.pan(numsteps)
Expand Down
5 changes: 0 additions & 5 deletions lib/matplotlib/ticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1753,11 +1753,6 @@ def view_limits(self, vmin, vmax):
"""
return mtransforms.nonsingular(vmin, vmax)

@cbook.deprecated("3.2")
def autoscale(self):
"""Autoscale the view limits."""
return self.view_limits(*self.axis.get_view_interval())

@cbook.deprecated("3.3")
def pan(self, numsteps):
"""Pan numticks (can be positive or negative)"""
Expand Down