From 02ef76926df3868cc980e962c09c472d33707422 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Tue, 12 Feb 2019 22:45:06 -0500 Subject: [PATCH 1/2] API: un-deprecate keyword only args to set_xlim, set_ylim These were originally documented and deprecated in #11137 however in later discussion we learned: - the 'left, right' / 'top, bottom' names don't make sense in the context of non-rectangular plots - we have at least one frustrated user The original names were `xmin, xmax` but were changed to `left, right` in 9ca5db03f692e73d155dbc7ca752413ccee01df6 (pre 1.0) and the kwarg popping was added for back-compatibility. --- doc/api/api_changes.rst | 5 +++-- lib/matplotlib/axes/_base.py | 14 ++------------ 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/doc/api/api_changes.rst b/doc/api/api_changes.rst index 1ff1e66734e2..4efd112cb81b 100644 --- a/doc/api/api_changes.rst +++ b/doc/api/api_changes.rst @@ -154,8 +154,9 @@ Different exception types for undocumented options and ``right`` arguments. :meth:`~matplotlib.axes.Axes.set_ylim` and the 3D equivalents (e.g. :meth:`~mpl_toolkits.axes.Axes3D.set_zlim3d`) had a corresponding problem. - The ``_min`` and ``_max`` arguments are now deprecated, and a ``TypeError`` - will be raised if they would override the earlier limit arguments. + A ``TypeError`` will be raised if they would override the earlier + limit arguments. In 3.0 these were kwargs were deprecated, but in 3.1 + the deprecation was undone. Improved call signature for ``Axes.margins`` diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index 9515e03e5d75..59ac04741a3d 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -3145,8 +3145,7 @@ def set_xlim(self, left=None, right=None, emit=True, auto=False, False turns off (default action), None leaves unchanged. xmin, xmax : scalar, optional - These arguments are deprecated and will be removed in a future - version. They are equivalent to left and right respectively, + They are equivalent to left and right respectively, and it is an error to pass both *xmin* and *left* or *xmax* and *right*. @@ -3188,14 +3187,10 @@ def set_xlim(self, left=None, right=None, emit=True, auto=False, if right is None and np.iterable(left): left, right = left if xmin is not None: - cbook.warn_deprecated('3.0', name='`xmin`', - alternative='`left`', obj_type='argument') if left is not None: raise TypeError('Cannot pass both `xmin` and `left`') left = xmin if xmax is not None: - cbook.warn_deprecated('3.0', name='`xmax`', - alternative='`right`', obj_type='argument') if right is not None: raise TypeError('Cannot pass both `xmax` and `right`') right = xmax @@ -3529,8 +3524,7 @@ def set_ylim(self, bottom=None, top=None, emit=True, auto=False, *False* turns off (default action), *None* leaves unchanged. ymin, ymax : scalar, optional - These arguments are deprecated and will be removed in a future - version. They are equivalent to bottom and top respectively, + They are equivalent to bottom and top respectively, and it is an error to pass both *ymin* and *bottom* or *ymax* and *top*. @@ -3571,14 +3565,10 @@ def set_ylim(self, bottom=None, top=None, emit=True, auto=False, if top is None and np.iterable(bottom): bottom, top = bottom if ymin is not None: - cbook.warn_deprecated('3.0', name='`ymin`', - alternative='`bottom`', obj_type='argument') if bottom is not None: raise TypeError('Cannot pass both `ymin` and `bottom`') bottom = ymin if ymax is not None: - cbook.warn_deprecated('3.0', name='`ymax`', - alternative='`top`', obj_type='argument') if top is not None: raise TypeError('Cannot pass both `ymax` and `top`') top = ymax From 4e426f30b37a0d5b4aab2ae311fcff8c679465d4 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Mon, 18 Feb 2019 15:07:19 -0500 Subject: [PATCH 2/2] DOC: add note in 3.1 API changes as well --- doc/api/next_api_changes/2018-01-28_tac.rst | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 doc/api/next_api_changes/2018-01-28_tac.rst diff --git a/doc/api/next_api_changes/2018-01-28_tac.rst b/doc/api/next_api_changes/2018-01-28_tac.rst new file mode 100644 index 000000000000..50dae92a833c --- /dev/null +++ b/doc/api/next_api_changes/2018-01-28_tac.rst @@ -0,0 +1,5 @@ +De-deprecate xmin, xmax kwargs to set_xlim and ymin, ymax kwargs to set_ylim +```````````````````````````````````````````````````````````````````````````` + +These kwargs were deprecated in 3.0, but due to user feedback and the +semantics of the new names are problematic for non-rectangular axes.