Skip to content

Remove deprecate #18822

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

Closed
wants to merge 3 commits into from
Closed
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
17 changes: 17 additions & 0 deletions doc/api/next_api_changes/behavior/18820-TH.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Unsupported arguments for ``axis()``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Passing more than one positional argument or unsupported keyword arguments to
`~.Axes.axis()` now raises a ``TypeError`` (such arguments used to be silently
ignored).

Length of parameter *where* in ``fill_between()`` and ``fill_betweenx()``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The parameter *where* in `~.Axes.fill_between()` and `~.Axes.fill_betweenx()`
must have the same length as the data points.

Default padding in ``AxesDivider``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The parameter *pad* in `.AxesDivider.new_horizontal()` now defaults to
:rc:`figure.subplot.wspace` instead of 0.
The parameter *pad* in `.AxesDivider.new_vertical()` now defaults to
:rc:`figure.subplot.hspace` instead of 0.
7 changes: 3 additions & 4 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5127,10 +5127,9 @@ def _fill_between_x_or_y(
else:
where = np.asarray(where, dtype=bool)
if where.size != ind.size:
cbook.warn_deprecated(
"3.2", message=f"Since %(since)s, the parameter *where* "
f"must have the same size as {ind} in {func_name}(). This "
"will become an error %(removal)s.")
raise ValueError(
f"Parameters 'where' and '{ind}' must have the same size "
f"in {func_name}()")
where = where & ~functools.reduce(
np.logical_or, map(np.ma.getmask, [ind, dep1, dep2]))

Expand Down
16 changes: 7 additions & 9 deletions lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1799,7 +1799,11 @@ def axis(self, *args, emit=True, **kwargs):
matplotlib.axes.Axes.set_xlim
matplotlib.axes.Axes.set_ylim
"""
if len(args) == 1 and isinstance(args[0], (str, bool)):
if len(args) > 1:
raise TypeError(
f'axis() takes from 0 to 1 positional arguments but '
f'{len(args)} were given')
if len(args) == 1 and isinstance(args[0], (str, bool)): # axis(option)
s = args[0]
if s is True:
s = 'on'
Expand Down Expand Up @@ -1841,15 +1845,9 @@ def axis(self, *args, emit=True, **kwargs):
raise ValueError('Unrecognized string %s to axis; '
'try on or off' % s)
else:
if len(args) >= 1:
if len(args) != 1:
cbook.warn_deprecated(
"3.2", message="Passing more than one positional "
"argument to axis() is deprecated and will raise a "
"TypeError %(removal)s.")
limits = args[0]
if len(args) == 1: # axis([xmin, xmax, ymin, ymax])
try:
xmin, xmax, ymin, ymax = limits
xmin, xmax, ymin, ymax = args[0]
except (TypeError, ValueError) as err:
raise TypeError('the first argument to axis() must be an '
'interable of the form '
Expand Down
13 changes: 5 additions & 8 deletions lib/mpl_toolkits/axes_grid1/axes_divider.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import numpy as np

import matplotlib as mpl
from matplotlib import _api, cbook
from matplotlib.axes import SubplotBase
from matplotlib.gridspec import SubplotSpec, GridSpec
Expand Down Expand Up @@ -439,6 +440,7 @@ def new_horizontal(self, size, pad=None, pack_start=False, **kwargs):
instance of the current axes.
pad : :mod:`~mpl_toolkits.axes_grid1.axes_size` or float or str
Pad between the axes. It takes same argument as *size*.
Defaults to :rc:`figure.subplot.wspace`.
pack_start : bool
If False, the new axes is appended at the end
of the list, i.e., it became the right-most axes. If True, it is
Expand All @@ -450,10 +452,7 @@ def new_horizontal(self, size, pad=None, pack_start=False, **kwargs):
main axes will be used.
"""
if pad is None:
cbook.warn_deprecated(
"3.2", message="In a future version, 'pad' will default to "
"rcParams['figure.subplot.wspace']. Set pad=0 to keep the "
"old behavior.")
pad = mpl.rcParams['figure.subplot.wspace']
if pad:
if not isinstance(pad, Size._Base):
pad = Size.from_any(pad, fraction_ref=self._xref)
Expand Down Expand Up @@ -488,6 +487,7 @@ def new_vertical(self, size, pad=None, pack_start=False, **kwargs):
instance of the current axes.
pad : :mod:`~mpl_toolkits.axes_grid1.axes_size` or float or str
Pad between the axes. It takes same argument as *size*.
Defaults to :rc:`figure.subplot.hspace`.
pack_start : bool
If False, the new axes is appended at the end
of the list, i.e., it became the right-most axes. If True, it is
Expand All @@ -499,10 +499,7 @@ def new_vertical(self, size, pad=None, pack_start=False, **kwargs):
main axes will be used.
"""
if pad is None:
cbook.warn_deprecated(
"3.2", message="In a future version, 'pad' will default to "
"rcParams['figure.subplot.hspace']. Set pad=0 to keep the "
"old behavior.")
pad = mpl.rcParams['figure.subplot.hspace']
if pad:
if not isinstance(pad, Size._Base):
pad = Size.from_any(pad, fraction_ref=self._yref)
Expand Down