Skip to content

API: un-deprecate keyword only args to set_xlim, set_ylim #13425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions doc/api/api_changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's reasonable to modify the changes in 3.0 section of the 3.1 docs. Additionally, I would add an entry to the section "changes in 3.1". People typically do not read the changelog of past versions.

limit arguments. In 3.0 these were kwargs were deprecated, but in 3.1
the deprecation was undone.


Improved call signature for ``Axes.margins``
Expand Down
5 changes: 5 additions & 0 deletions doc/api/next_api_changes/2018-01-28_tac.rst
Original file line number Diff line number Diff line change
@@ -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.
14 changes: 2 additions & 12 deletions lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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*.

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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*.

Expand Down Expand Up @@ -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
Expand Down