Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitec1c382

Browse files
committed
Deprecate smart_bounds in Axis and Spine.
1 parent633a83c commitec1c382

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

‎examples/ticks_and_spines/spine_placement_demo.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
ax.spines['right'].set_color('none')
2323
ax.spines['bottom'].set_position('center')
2424
ax.spines['top'].set_color('none')
25-
ax.spines['left'].set_smart_bounds(True)
26-
ax.spines['bottom'].set_smart_bounds(True)
2725
ax.xaxis.set_ticks_position('bottom')
2826
ax.yaxis.set_ticks_position('left')
2927

@@ -34,8 +32,6 @@
3432
ax.spines['right'].set_color('none')
3533
ax.spines['bottom'].set_position('zero')
3634
ax.spines['top'].set_color('none')
37-
ax.spines['left'].set_smart_bounds(True)
38-
ax.spines['bottom'].set_smart_bounds(True)
3935
ax.xaxis.set_ticks_position('bottom')
4036
ax.yaxis.set_ticks_position('left')
4137

@@ -46,8 +42,6 @@
4642
ax.spines['right'].set_color('none')
4743
ax.spines['bottom'].set_position(('axes',0.1))
4844
ax.spines['top'].set_color('none')
49-
ax.spines['left'].set_smart_bounds(True)
50-
ax.spines['bottom'].set_smart_bounds(True)
5145
ax.xaxis.set_ticks_position('bottom')
5246
ax.yaxis.set_ticks_position('left')
5347

@@ -58,8 +52,6 @@
5852
ax.spines['right'].set_color('none')
5953
ax.spines['bottom'].set_position(('data',2))
6054
ax.spines['top'].set_color('none')
61-
ax.spines['left'].set_smart_bounds(True)
62-
ax.spines['bottom'].set_smart_bounds(True)
6355
ax.xaxis.set_ticks_position('bottom')
6456
ax.yaxis.set_ticks_position('left')
6557

@@ -71,7 +63,6 @@ def adjust_spines(ax, spines):
7163
forloc,spineinax.spines.items():
7264
iflocinspines:
7365
spine.set_position(('outward',10))# outward by 10 points
74-
spine.set_smart_bounds(True)
7566
else:
7667
spine.set_color('none')# don't draw spine
7768

‎lib/matplotlib/axis.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ def __init__(self, axes, pickradius=15):
763763
self.callbacks=cbook.CallbackRegistry()
764764

765765
self._autolabelpos=True
766-
self._smart_bounds=False
766+
self._smart_bounds=False# Deprecated in 3.2
767767

768768
self.label=self._get_label()
769769
self.labelpad=rcParams['axes.labelpad']
@@ -1085,11 +1085,13 @@ def get_ticklabel_extents(self, renderer):
10851085
bbox2=mtransforms.Bbox.from_extents(0,0,0,0)
10861086
returnbbox,bbox2
10871087

1088+
@cbook.deprecated("3.2")
10881089
defset_smart_bounds(self,value):
10891090
"""Set the axis to have smart bounds."""
10901091
self._smart_bounds=value
10911092
self.stale=True
10921093

1094+
@cbook.deprecated("3.2")
10931095
defget_smart_bounds(self):
10941096
"""Return whether the axis has smart bounds."""
10951097
returnself._smart_bounds
@@ -1121,7 +1123,7 @@ def _update_ticks(self):
11211123
ifview_low>view_high:
11221124
view_low,view_high=view_high,view_low
11231125

1124-
ifself._smart_boundsandticks:
1126+
ifself._smart_boundsandticks:# _smart_bounds is deprecated in 3.2
11251127
# handle inverted limits
11261128
data_low,data_high=sorted(self.get_data_interval())
11271129
locs=np.sort([tick.get_loc()fortickinticks])

‎lib/matplotlib/spines.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
importmatplotlib
44
frommatplotlibimportcbook,docstring,rcParams
55
frommatplotlib.artistimportallow_rasterization
6+
importmatplotlib.cbookascbook
67
importmatplotlib.transformsasmtransforms
78
importmatplotlib.patchesasmpatches
89
importmatplotlib.pathasmpath
@@ -56,7 +57,7 @@ def __init__(self, axes, spine_type, path, **kwargs):
5657
self.set_transform(self.axes.transData)# default transform
5758

5859
self._bounds=None# default bounds
59-
self._smart_bounds=False
60+
self._smart_bounds=False# deprecated in 3.2
6061

6162
# Defer initial position determination. (Not much support for
6263
# non-rectangular axes is currently implemented, and this lets
@@ -77,6 +78,7 @@ def __init__(self, axes, spine_type, path, **kwargs):
7778
# Note: This cannot be calculated until this is added to an Axes
7879
self._patch_transform=mtransforms.IdentityTransform()
7980

81+
@cbook.deprecated("3.2")
8082
defset_smart_bounds(self,value):
8183
"""Set the spine and associated axis to have smart bounds."""
8284
self._smart_bounds=value
@@ -88,6 +90,7 @@ def set_smart_bounds(self, value):
8890
self.axes.xaxis.set_smart_bounds(value)
8991
self.stale=True
9092

93+
@cbook.deprecated("3.2")
9194
defget_smart_bounds(self):
9295
"""Return whether the spine has smart bounds."""
9396
returnself._smart_bounds
@@ -268,7 +271,7 @@ def _adjust_location(self):
268271
raiseValueError('unknown spine spine_type: %s'%
269272
self.spine_type)
270273

271-
ifself._smart_bounds:
274+
ifself._smart_bounds:# deprecated in 3.2
272275
# attempt to set bounds in sophisticated way
273276

274277
# handle inverted limits

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp