diff --git a/doc/api/next_api_changes/2018-09-27-AL.rst b/doc/api/next_api_changes/2018-09-27-AL.rst new file mode 100644 index 000000000000..f938332b776c --- /dev/null +++ b/doc/api/next_api_changes/2018-09-27-AL.rst @@ -0,0 +1,4 @@ +Passing 'normal' to `Axes.axis()` is deprecated +``````````````````````````````````````````````` + +Use ``axis('auto')`` instead. diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index 712c9f097371..210f611f07af 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -1263,7 +1263,8 @@ def set_aspect(self, aspect, adjustable=None, anchor=None, share=False): matplotlib.axes.Axes.set_anchor defining the position in case of extra space. """ - if not (isinstance(aspect, str) and aspect in ('equal', 'auto')): + if not (cbook._str_equal(aspect, 'equal') + or cbook._str_equal(aspect, 'auto')): aspect = float(aspect) # raise ValueError if necessary if share: axes = set(self._shared_x_axes.get_siblings(self) @@ -1645,6 +1646,10 @@ def axis(self, *v, **kwargs): self.set_axis_off() elif s in ('equal', 'tight', 'scaled', 'normal', 'auto', 'image', 'square'): + if s == 'normal': + cbook.warn_deprecated( + "3.1", "Passing 'normal' to axis() is deprecated " + "since %(version)s; use 'auto' instead.") self.set_autoscale_on(True) self.set_aspect('auto') self.autoscale_view(tight=False)