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

Skip to content

Commit 405684d

Browse files
authored
Merge pull request #18513 from QuLogic/delete-autoscale
API: Remove Locator.autoscale.
2 parents ab6cc37 + 9021a79 commit 405684d

File tree

5 files changed

+12
-74
lines changed

5 files changed

+12
-74
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Locators
2+
~~~~~~~~
3+
The unused ``Locator.autoscale`` method has been removed (pass the axis limits
4+
to `.Locator.view_limits` instead). Any derived methods are also removed:
5+
6+
* ``Locator.autoscale``
7+
* ``AutoDateLocator.autoscale``
8+
* ``RRuleLocator.autoscale``
9+
* ``RadialLocator.autoscale``
10+
* ``ThetaLocator.autoscale``
11+
* ``YearLocator.autoscale``

doc/api/prev_api_changes/api_changes_3.2.0/deprecations.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ Deprecation of the constructor means that classes inheriting from
113113

114114
Locators
115115
~~~~~~~~
116-
The unused `.Locator.autoscale` method is deprecated (pass the axis limits to
116+
The unused ``Locator.autoscale`` method is deprecated (pass the axis limits to
117117
`.Locator.view_limits` instead).
118118

119119
Animation

lib/matplotlib/dates.py

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,42 +1194,6 @@ def get_unit_generic(freq):
11941194
def _get_interval(self):
11951195
return self.rule._rrule._interval
11961196

1197-
@cbook.deprecated("3.2")
1198-
def autoscale(self):
1199-
"""
1200-
Set the view limits to include the data range.
1201-
"""
1202-
dmin, dmax = self.datalim_to_dt()
1203-
delta = relativedelta(dmax, dmin)
1204-
1205-
# We need to cap at the endpoints of valid datetime
1206-
try:
1207-
start = dmin - delta
1208-
except ValueError:
1209-
start = _from_ordinalf(1.0)
1210-
1211-
try:
1212-
stop = dmax + delta
1213-
except ValueError:
1214-
# The magic number!
1215-
stop = _from_ordinalf(3652059.9999999)
1216-
1217-
self.rule.set(dtstart=start, until=stop)
1218-
dmin, dmax = self.datalim_to_dt()
1219-
1220-
vmin = self.rule.before(dmin, True)
1221-
if not vmin:
1222-
vmin = dmin
1223-
1224-
vmax = self.rule.after(dmax, True)
1225-
if not vmax:
1226-
vmax = dmax
1227-
1228-
vmin = date2num(vmin)
1229-
vmax = date2num(vmax)
1230-
1231-
return self.nonsingular(vmin, vmax)
1232-
12331197

12341198
class AutoDateLocator(DateLocator):
12351199
"""
@@ -1363,12 +1327,6 @@ def _get_unit(self):
13631327
else:
13641328
return RRuleLocator.get_unit_generic(self._freq)
13651329

1366-
@cbook.deprecated("3.2")
1367-
def autoscale(self):
1368-
"""Try to choose the view limits intelligently."""
1369-
dmin, dmax = self.datalim_to_dt()
1370-
return self.get_locator(dmin, dmax).autoscale()
1371-
13721330
def get_locator(self, dmin, dmax):
13731331
"""Pick the best locator based on a distance."""
13741332
delta = relativedelta(dmax, dmin)
@@ -1538,24 +1496,6 @@ def tick_values(self, vmin, vmax):
15381496

15391497
ticks.append(dt)
15401498

1541-
@cbook.deprecated("3.2")
1542-
def autoscale(self):
1543-
"""
1544-
Set the view limits to include the data range.
1545-
"""
1546-
dmin, dmax = self.datalim_to_dt()
1547-
1548-
ymin = self.base.le(dmin.year)
1549-
ymax = self.base.ge(dmax.year)
1550-
vmin = dmin.replace(year=ymin, **self.replaced)
1551-
vmin = vmin.astimezone(self.tz)
1552-
vmax = dmax.replace(year=ymax, **self.replaced)
1553-
vmax = vmax.astimezone(self.tz)
1554-
1555-
vmin = date2num(vmin)
1556-
vmax = date2num(vmax)
1557-
return self.nonsingular(vmin, vmax)
1558-
15591499

15601500
class MonthLocator(RRuleLocator):
15611501
"""

lib/matplotlib/projections/polar.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,6 @@ def __call__(self):
245245
else:
246246
return np.deg2rad(self.base())
247247

248-
@cbook.deprecated("3.2")
249-
def autoscale(self):
250-
return self.base.autoscale()
251-
252248
@cbook.deprecated("3.3")
253249
def pan(self, numsteps):
254250
return self.base.pan(numsteps)
@@ -431,10 +427,6 @@ def __call__(self):
431427
else:
432428
return [tick for tick in self.base() if tick > rorigin]
433429

434-
@cbook.deprecated("3.2")
435-
def autoscale(self):
436-
return self.base.autoscale()
437-
438430
@cbook.deprecated("3.3")
439431
def pan(self, numsteps):
440432
return self.base.pan(numsteps)

lib/matplotlib/ticker.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1753,11 +1753,6 @@ def view_limits(self, vmin, vmax):
17531753
"""
17541754
return mtransforms.nonsingular(vmin, vmax)
17551755

1756-
@cbook.deprecated("3.2")
1757-
def autoscale(self):
1758-
"""Autoscale the view limits."""
1759-
return self.view_limits(*self.axis.get_view_interval())
1760-
17611756
@cbook.deprecated("3.3")
17621757
def pan(self, numsteps):
17631758
"""Pan numticks (can be positive or negative)"""

0 commit comments

Comments
 (0)