From 9021a7970891ef07df37670603858ad14227e5c0 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 18 Sep 2020 04:32:39 -0400 Subject: [PATCH] Remove Locator.autoscale. --- .../next_api_changes/removals/18513-ES.rst | 11 ++++ .../api_changes_3.2.0/deprecations.rst | 2 +- lib/matplotlib/dates.py | 60 ------------------- lib/matplotlib/projections/polar.py | 8 --- lib/matplotlib/ticker.py | 5 -- 5 files changed, 12 insertions(+), 74 deletions(-) create mode 100644 doc/api/next_api_changes/removals/18513-ES.rst diff --git a/doc/api/next_api_changes/removals/18513-ES.rst b/doc/api/next_api_changes/removals/18513-ES.rst new file mode 100644 index 000000000000..62ed3b92565e --- /dev/null +++ b/doc/api/next_api_changes/removals/18513-ES.rst @@ -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`` diff --git a/doc/api/prev_api_changes/api_changes_3.2.0/deprecations.rst b/doc/api/prev_api_changes/api_changes_3.2.0/deprecations.rst index b6e47da29a7b..9ecabcb8af27 100644 --- a/doc/api/prev_api_changes/api_changes_3.2.0/deprecations.rst +++ b/doc/api/prev_api_changes/api_changes_3.2.0/deprecations.rst @@ -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 diff --git a/lib/matplotlib/dates.py b/lib/matplotlib/dates.py index 5cff1ae9c059..08867d3c57e4 100644 --- a/lib/matplotlib/dates.py +++ b/lib/matplotlib/dates.py @@ -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): """ @@ -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) @@ -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): """ diff --git a/lib/matplotlib/projections/polar.py b/lib/matplotlib/projections/polar.py index d0c7c8d61a4f..1ebc8714ce7a 100644 --- a/lib/matplotlib/projections/polar.py +++ b/lib/matplotlib/projections/polar.py @@ -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) @@ -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) diff --git a/lib/matplotlib/ticker.py b/lib/matplotlib/ticker.py index abe56e632bb5..714289c97f87 100644 --- a/lib/matplotlib/ticker.py +++ b/lib/matplotlib/ticker.py @@ -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)"""