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

Skip to content

Commit e7b8533

Browse files
authored
Merge pull request #12314 from anntzer/abnormal
Deprecate `axis('normal')` in favor of `axis('auto')`.
2 parents 7afef94 + 8d9cc12 commit e7b8533

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Passing 'normal' to `Axes.axis()` is deprecated
2+
```````````````````````````````````````````````
3+
4+
Use ``axis('auto')`` instead.

lib/matplotlib/axes/_base.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,8 @@ def set_aspect(self, aspect, adjustable=None, anchor=None, share=False):
12671267
matplotlib.axes.Axes.set_anchor
12681268
defining the position in case of extra space.
12691269
"""
1270-
if not (isinstance(aspect, str) and aspect in ('equal', 'auto')):
1270+
if not (cbook._str_equal(aspect, 'equal')
1271+
or cbook._str_equal(aspect, 'auto')):
12711272
aspect = float(aspect) # raise ValueError if necessary
12721273
if share:
12731274
axes = set(self._shared_x_axes.get_siblings(self)
@@ -1649,6 +1650,10 @@ def axis(self, *v, **kwargs):
16491650
self.set_axis_off()
16501651
elif s in ('equal', 'tight', 'scaled', 'normal',
16511652
'auto', 'image', 'square'):
1653+
if s == 'normal':
1654+
cbook.warn_deprecated(
1655+
"3.1", "Passing 'normal' to axis() is deprecated "
1656+
"since %(version)s; use 'auto' instead.")
16521657
self.set_autoscale_on(True)
16531658
self.set_aspect('auto')
16541659
self.autoscale_view(tight=False)

0 commit comments

Comments
 (0)