Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 01b3e51

Browse filesBrowse files
committed
Remove deprecated 'smart bounds' functionality.
1 parent 7e89381 commit 01b3e51
Copy full SHA for 01b3e51

File tree

Expand file treeCollapse file tree

4 files changed

+16
-119
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+16
-119
lines changed

‎doc/api/axis_api.rst

Copy file name to clipboardExpand all lines: doc/api/axis_api.rst
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,6 @@ Other
226226
Axis.limit_range_for_scale
227227
Axis.reset_ticks
228228
Axis.set_default_intervals
229-
Axis.get_smart_bounds
230-
Axis.set_smart_bounds
231229

232230
Discouraged
233231
-----------

‎doc/api/next_api_changes/removals/18747-ES.rst

Copy file name to clipboardExpand all lines: doc/api/next_api_changes/removals/18747-ES.rst
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,12 @@
1616

1717
- ``quiver.QuiverKey.quiverkey_doc`` has been removed; use
1818
``quiver.QuiverKey.__init__.__doc__`` instead.
19+
20+
Smart bounds
21+
~~~~~~~~~~~~
22+
23+
The "smart bounds" functionality on `~.axis.Axis` and `.Spine` has been
24+
deleted, and the following methods are removed:
25+
26+
- ``Axis.set_smart_bounds`` and ``Axis.get_smart_bounds``
27+
- ``Spine.set_smart_bounds`` and ``Spine.get_smart_bounds``

‎lib/matplotlib/axis.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axis.py
-42Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,6 @@ def __init__(self, axes, pickradius=15):
673673
self.callbacks = cbook.CallbackRegistry()
674674

675675
self._autolabelpos = True
676-
self._smart_bounds = False # Deprecated in 3.2
677676

678677
self.label = mtext.Text(
679678
np.nan, np.nan,
@@ -1010,17 +1009,6 @@ def get_ticklabel_extents(self, renderer):
10101009
bbox2 = mtransforms.Bbox.from_extents(0, 0, 0, 0)
10111010
return bbox, bbox2
10121011

1013-
@_api.deprecated("3.2")
1014-
def set_smart_bounds(self, value):
1015-
"""Set the axis to have smart bounds."""
1016-
self._smart_bounds = value
1017-
self.stale = True
1018-
1019-
@_api.deprecated("3.2")
1020-
def get_smart_bounds(self):
1021-
"""Return whether the axis has smart bounds."""
1022-
return self._smart_bounds
1023-
10241012
def _update_ticks(self):
10251013
"""
10261014
Update ticks (position and labels) using the current data interval of
@@ -1048,36 +1036,6 @@ def _update_ticks(self):
10481036
if view_low > view_high:
10491037
view_low, view_high = view_high, view_low
10501038

1051-
if self._smart_bounds and ticks: # _smart_bounds is deprecated in 3.2
1052-
# handle inverted limits
1053-
data_low, data_high = sorted(self.get_data_interval())
1054-
locs = np.sort([tick.get_loc() for tick in ticks])
1055-
if data_low <= view_low:
1056-
# data extends beyond view, take view as limit
1057-
ilow = view_low
1058-
else:
1059-
# data stops within view, take best tick
1060-
good_locs = locs[locs <= data_low]
1061-
if len(good_locs):
1062-
# last tick prior or equal to first data point
1063-
ilow = good_locs[-1]
1064-
else:
1065-
# No ticks (why not?), take first tick
1066-
ilow = locs[0]
1067-
if data_high >= view_high:
1068-
# data extends beyond view, take view as limit
1069-
ihigh = view_high
1070-
else:
1071-
# data stops within view, take best tick
1072-
good_locs = locs[locs >= data_high]
1073-
if len(good_locs):
1074-
# first tick after or equal to last data point
1075-
ihigh = good_locs[0]
1076-
else:
1077-
# No ticks (why not?), take last tick
1078-
ihigh = locs[-1]
1079-
ticks = [tick for tick in ticks if ilow <= tick.get_loc() <= ihigh]
1080-
10811039
interval_t = self.get_transform().transform([view_low, view_high])
10821040

10831041
ticks_to_draw = []

‎lib/matplotlib/spines.py

Copy file name to clipboardExpand all lines: lib/matplotlib/spines.py
+7-75Lines changed: 7 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ def __init__(self, axes, spine_type, path, **kwargs):
6161
self.set_transform(self.axes.transData) # default transform
6262

6363
self._bounds = None # default bounds
64-
self._smart_bounds = False # deprecated in 3.2
6564

6665
# Defer initial position determination. (Not much support for
6766
# non-rectangular axes is currently implemented, and this lets
@@ -82,23 +81,6 @@ def __init__(self, axes, spine_type, path, **kwargs):
8281
# Note: This cannot be calculated until this is added to an Axes
8382
self._patch_transform = mtransforms.IdentityTransform()
8483

85-
@_api.deprecated("3.2")
86-
def set_smart_bounds(self, value):
87-
"""Set the spine and associated axis to have smart bounds."""
88-
self._smart_bounds = value
89-
90-
# also set the axis if possible
91-
if self.spine_type in ('left', 'right'):
92-
self.axes.yaxis.set_smart_bounds(value)
93-
elif self.spine_type in ('top', 'bottom'):
94-
self.axes.xaxis.set_smart_bounds(value)
95-
self.stale = True
96-
97-
@_api.deprecated("3.2")
98-
def get_smart_bounds(self):
99-
"""Return whether the spine has smart bounds."""
100-
return self._smart_bounds
101-
10284
def set_patch_arc(self, center, radius, theta1, theta2):
10385
"""Set the spine to be arc-like."""
10486
self._patch_type = 'arc'
@@ -247,64 +229,14 @@ def _adjust_location(self):
247229
if self.spine_type == 'circle':
248230
return
249231

250-
if self._bounds is None:
251-
if self.spine_type in ('left', 'right'):
252-
low, high = self.axes.viewLim.intervaly
253-
elif self.spine_type in ('top', 'bottom'):
254-
low, high = self.axes.viewLim.intervalx
255-
else:
256-
raise ValueError('unknown spine spine_type: %s' %
257-
self.spine_type)
258-
259-
if self._smart_bounds: # deprecated in 3.2
260-
# attempt to set bounds in sophisticated way
261-
262-
# handle inverted limits
263-
viewlim_low, viewlim_high = sorted([low, high])
264-
265-
if self.spine_type in ('left', 'right'):
266-
datalim_low, datalim_high = self.axes.dataLim.intervaly
267-
ticks = self.axes.get_yticks()
268-
elif self.spine_type in ('top', 'bottom'):
269-
datalim_low, datalim_high = self.axes.dataLim.intervalx
270-
ticks = self.axes.get_xticks()
271-
# handle inverted limits
272-
ticks = np.sort(ticks)
273-
datalim_low, datalim_high = sorted([datalim_low, datalim_high])
274-
275-
if datalim_low < viewlim_low:
276-
# Data extends past view. Clip line to view.
277-
low = viewlim_low
278-
else:
279-
# Data ends before view ends.
280-
cond = (ticks <= datalim_low) & (ticks >= viewlim_low)
281-
tickvals = ticks[cond]
282-
if len(tickvals):
283-
# A tick is less than or equal to lowest data point.
284-
low = tickvals[-1]
285-
else:
286-
# No tick is available
287-
low = datalim_low
288-
low = max(low, viewlim_low)
289-
290-
if datalim_high > viewlim_high:
291-
# Data extends past view. Clip line to view.
292-
high = viewlim_high
293-
else:
294-
# Data ends before view ends.
295-
cond = (ticks >= datalim_high) & (ticks <= viewlim_high)
296-
tickvals = ticks[cond]
297-
if len(tickvals):
298-
# A tick is greater than or equal to highest data
299-
# point.
300-
high = tickvals[0]
301-
else:
302-
# No tick is available
303-
high = datalim_high
304-
high = min(high, viewlim_high)
305-
306-
else:
232+
if self._bounds is not None:
307233
low, high = self._bounds
234+
elif self.spine_type in ('left', 'right'):
235+
low, high = self.axes.viewLim.intervaly
236+
elif self.spine_type in ('top', 'bottom'):
237+
low, high = self.axes.viewLim.intervalx
238+
else:
239+
raise ValueError(f'unknown spine spine_type: {self.spine_type}')
308240

309241
if self._patch_type == 'arc':
310242
if self.spine_type in ('bottom', 'top'):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.