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

Skip to content

Commit 1a07b9f

Browse files
committed
Remove deprecated parameters.
1 parent 01b3e51 commit 1a07b9f

File tree

10 files changed

+55
-54
lines changed

10 files changed

+55
-54
lines changed

doc/api/next_api_changes/removals/18747-ES.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@
66
instead
77
- ``axes.SubplotBase.colNum``; use ``ax.get_subplotspec().colspan.start``
88
instead
9+
- the *verts* parameter to ``scatter`` (use *marker* instead)
10+
- Passing more than one positional argument to `~matplotlib.axes.Axes.axis`
11+
will now raise an error.
12+
- Passing ``"range"`` to the *whis* parameter of `.Axes.boxplot` and
13+
`.cbook.boxplot_stats` to mean "the whole data range" is no longer
14+
supported.
15+
- Passing scalars to parameter *where* in `.axes.Axes.fill_between` and
16+
`.axes.Axes.fill_betweenx` is no longer accepted and non-matching sizes now
17+
raise a `ValueError`.
918

1019
``dates`` functions
1120
~~~~~~~~~~~~~~~~~~~
@@ -25,3 +34,19 @@ deleted, and the following methods are removed:
2534

2635
- ``Axis.set_smart_bounds`` and ``Axis.get_smart_bounds``
2736
- ``Spine.set_smart_bounds`` and ``Spine.get_smart_bounds``
37+
38+
Testing
39+
~~~~~~~
40+
The *switch_backend_warn* parameter to ``matplotlib.test`` has no effect and
41+
has been removed.
42+
43+
``tight_layout()``
44+
~~~~~~~~~~~~~~~~~~
45+
The *renderer* parameter to `.Figure.tight_layout` has been removed; this
46+
method now always uses the renderer instance cached on the `.Figure`.
47+
48+
``axes_grid1``
49+
~~~~~~~~~~~~~~
50+
- The *locator* parameter to ``colorbar()`` has been removed in favor of its
51+
synonym *ticks* (which already existed previously, and is consistent with
52+
:mod:`matplotlib.colorbar`).

doc/api/prev_api_changes/api_changes_3.2.0/deprecations.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ Passing scalars to parameter *where* in ``fill_between()`` and
142142
broadcasted to the size of *x*. Non-matching sizes will raise a ``ValueError``
143143
in the future.
144144

145+
``scatter()``
146+
~~~~~~~~~~~~~
147+
Passing the *verts* parameter to `.axes.Axes.scatter` is deprecated; use the
148+
*marker* parameter instead.
149+
145150
``tight_layout()``
146151
~~~~~~~~~~~~~~~~~~
147152
The ``renderer`` parameter to `.Figure.tight_layout` is deprecated; this method
@@ -255,8 +260,8 @@ both 1) matplotlib's conftests have not been called and 2) nose is in
255260
During the deprecation period, to force the generation of nose base tests,
256261
import nose first.
257262

258-
The ``switch_backend_warn`` parameter to ``matplotlib.test`` has no effect and
259-
is deprecated.
263+
The *switch_backend_warn* parameter to ``matplotlib.test`` has no effect and is
264+
deprecated.
260265

261266
``testing.jpl_units.UnitDbl.UnitDbl.checkUnits`` is deprecated.
262267

doc/api/prev_api_changes/api_changes_3.2.0/removals.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ The following API elements have been removed:
5757
instead)
5858
- ``axisartist.axes_divider.Axes``, ``axisartist.axes_divider.LocatableAxes``
5959
(use ``axisartist.axislines.Axes`` instead)
60-
- the ``normed`` kwarg to ``hist`` (use ``density`` instead)
61-
- the ``verts`` parameter to ``scatter`` (use ``marker`` instead)
60+
- the *normed* keyword argument to ``hist`` (use *density* instead)
6261
- passing ``(verts, 0)`` or ``(..., 3)`` when specifying a marker to specify a
6362
path or a circle, respectively (instead, use ``verts`` or ``"o"``,
6463
respectively)

lib/matplotlib/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,10 +1193,8 @@ def _init_tests():
11931193
"" if ft2font.__freetype_build_type__ == 'local' else "not "))
11941194

11951195

1196-
@cbook._delete_parameter("3.2", "switch_backend_warn")
11971196
@cbook._delete_parameter("3.3", "recursionlimit")
1198-
def test(verbosity=None, coverage=False, switch_backend_warn=True,
1199-
recursionlimit=0, **kwargs):
1197+
def test(verbosity=None, coverage=False, *, recursionlimit=0, **kwargs):
12001198
"""Run the matplotlib test suite."""
12011199

12021200
try:

lib/matplotlib/axes/_axes.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3472,7 +3472,6 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
34723472
If a pair of floats, they indicate the percentiles at which to
34733473
draw the whiskers (e.g., (5, 95)). In particular, setting this to
34743474
(0, 100) results in whiskers covering the whole range of the data.
3475-
"range" is a deprecated synonym for (0, 100).
34763475
34773476
In the edge case where ``Q1 == Q3``, *whis* is automatically set
34783477
to (0, 100) (cover the whole range of the data) if *autorange* is
@@ -4224,11 +4223,9 @@ def invalid_shape_exception(csize, xsize):
42244223
"edgecolors", "c", "facecolor",
42254224
"facecolors", "color"],
42264225
label_namer="y")
4227-
@cbook._delete_parameter("3.2", "verts")
42284226
def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
4229-
vmin=None, vmax=None, alpha=None, linewidths=None,
4230-
verts=None, edgecolors=None, *, plotnonfinite=False,
4231-
**kwargs):
4227+
vmin=None, vmax=None, alpha=None, linewidths=None, *,
4228+
edgecolors=None, plotnonfinite=False, **kwargs):
42324229
"""
42334230
A scatter plot of *y* vs. *x* with varying marker size and/or color.
42344231
@@ -5097,7 +5094,6 @@ def _fill_between_x_or_y(
50975094
"""
50985095

50995096
dep_dir = {"x": "y", "y": "x"}[ind_dir]
5100-
func_name = {"x": "fill_between", "y": "fill_betweenx"}[dep_dir]
51015097

51025098
if not rcParams["_internal.classic_mode"]:
51035099
kwargs = cbook.normalize_kwargs(kwargs, mcoll.Collection)
@@ -5120,10 +5116,8 @@ def _fill_between_x_or_y(
51205116
else:
51215117
where = np.asarray(where, dtype=bool)
51225118
if where.size != ind.size:
5123-
cbook.warn_deprecated(
5124-
"3.2", message=f"Since %(since)s, the parameter *where* "
5125-
f"must have the same size as {ind} in {func_name}(). This "
5126-
"will become an error %(removal)s.")
5119+
raise ValueError(f"where size ({where.size}) does not match "
5120+
f"{ind_dir} size ({ind.size})")
51275121
where = where & ~functools.reduce(
51285122
np.logical_or, map(np.ma.getmask, [ind, dep1, dep2]))
51295123

lib/matplotlib/axes/_base.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1781,7 +1781,10 @@ def axis(self, *args, emit=True, **kwargs):
17811781
matplotlib.axes.Axes.set_xlim
17821782
matplotlib.axes.Axes.set_ylim
17831783
"""
1784-
if len(args) == 1 and isinstance(args[0], (str, bool)):
1784+
if len(args) > 1:
1785+
raise TypeError("axis() takes 0 or 1 positional arguments but "
1786+
f"{len(args)} were given")
1787+
elif len(args) == 1 and isinstance(args[0], (str, bool)):
17851788
s = args[0]
17861789
if s is True:
17871790
s = 'on'
@@ -1823,12 +1826,7 @@ def axis(self, *args, emit=True, **kwargs):
18231826
raise ValueError('Unrecognized string %s to axis; '
18241827
'try on or off' % s)
18251828
else:
1826-
if len(args) >= 1:
1827-
if len(args) != 1:
1828-
cbook.warn_deprecated(
1829-
"3.2", message="Passing more than one positional "
1830-
"argument to axis() is deprecated and will raise a "
1831-
"TypeError %(removal)s.")
1829+
if len(args) == 1:
18321830
limits = args[0]
18331831
try:
18341832
xmin, xmax, ymin, ymax = limits

lib/matplotlib/cbook/__init__.py

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,8 +1055,7 @@ def boxplot_stats(X, whis=1.5, bootstrap=None, labels=None,
10551055
10561056
If a pair of floats, they indicate the percentiles at which to draw the
10571057
whiskers (e.g., (5, 95)). In particular, setting this to (0, 100)
1058-
results in whiskers covering the whole range of the data. "range" is
1059-
a deprecated synonym for (0, 100).
1058+
results in whiskers covering the whole range of the data.
10601059
10611060
In the edge case where ``Q1 == Q3``, *whis* is automatically set to
10621061
(0, 100) (cover the whole range of the data) if *autorange* is True.
@@ -1199,22 +1198,13 @@ def _compute_conf_interval(data, med, iqr, bootstrap):
11991198
)
12001199

12011200
# lowest/highest non-outliers
1202-
if np.isscalar(whis):
1203-
if np.isreal(whis):
1204-
loval = q1 - whis * stats['iqr']
1205-
hival = q3 + whis * stats['iqr']
1206-
elif whis in ['range', 'limit', 'limits', 'min/max']:
1207-
warn_deprecated(
1208-
"3.2", message=f"Setting whis to {whis!r} is deprecated "
1209-
"since %(since)s and support for it will be removed "
1210-
"%(removal)s; set it to [0, 100] to achieve the same "
1211-
"effect.")
1212-
loval = np.min(x)
1213-
hival = np.max(x)
1214-
else:
1215-
raise ValueError('whis must be a float or list of percentiles')
1216-
else:
1201+
if np.iterable(whis) and not isinstance(whis, str):
12171202
loval, hival = np.percentile(x, whis)
1203+
elif np.isreal(whis):
1204+
loval = q1 - whis * stats['iqr']
1205+
hival = q3 + whis * stats['iqr']
1206+
else:
1207+
raise ValueError('whis must be a float or list of percentiles')
12181208

12191209
# get high extreme
12201210
wiskhi = x[x <= hival]

lib/matplotlib/figure.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3211,9 +3211,7 @@ def execute_constrained_layout(self, renderer=None):
32113211
renderer = get_renderer(fig)
32123212
do_constrained_layout(fig, renderer, h_pad, w_pad, hspace, wspace)
32133213

3214-
@cbook._delete_parameter("3.2", "renderer")
3215-
def tight_layout(self, renderer=None, pad=1.08, h_pad=None, w_pad=None,
3216-
rect=None):
3214+
def tight_layout(self, *, pad=1.08, h_pad=None, w_pad=None, rect=None):
32173215
"""
32183216
Adjust the padding between and around subplots.
32193217
@@ -3223,8 +3221,6 @@ def tight_layout(self, renderer=None, pad=1.08, h_pad=None, w_pad=None,
32233221
32243222
Parameters
32253223
----------
3226-
renderer : subclass of `~.backend_bases.RendererBase`, optional
3227-
Defaults to the renderer for the figure. Deprecated.
32283224
pad : float, default: 1.08
32293225
Padding between the figure edge and the edges of subplots,
32303226
as a fraction of the font size.
@@ -3250,8 +3246,7 @@ def tight_layout(self, renderer=None, pad=1.08, h_pad=None, w_pad=None,
32503246
"compatible with tight_layout, so results "
32513247
"might be incorrect.")
32523248

3253-
if renderer is None:
3254-
renderer = get_renderer(self)
3249+
renderer = get_renderer(self)
32553250
ctx = (renderer._draw_disabled()
32563251
if hasattr(renderer, '_draw_disabled')
32573252
else suppress())

lib/matplotlib/pyplot.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2983,14 +2983,12 @@ def quiverkey(Q, X, Y, U, label, **kw):
29832983
@_copy_docstring_and_deprecators(Axes.scatter)
29842984
def scatter(
29852985
x, y, s=None, c=None, marker=None, cmap=None, norm=None,
2986-
vmin=None, vmax=None, alpha=None, linewidths=None,
2987-
verts=_api.deprecation._deprecated_parameter, edgecolors=None,
2988-
*, plotnonfinite=False, data=None, **kwargs):
2986+
vmin=None, vmax=None, alpha=None, linewidths=None, *,
2987+
edgecolors=None, plotnonfinite=False, data=None, **kwargs):
29892988
__ret = gca().scatter(
29902989
x, y, s=s, c=c, marker=marker, cmap=cmap, norm=norm,
29912990
vmin=vmin, vmax=vmax, alpha=alpha, linewidths=linewidths,
2992-
verts=verts, edgecolors=edgecolors,
2993-
plotnonfinite=plotnonfinite,
2991+
edgecolors=edgecolors, plotnonfinite=plotnonfinite,
29942992
**({"data": data} if data is not None else {}), **kwargs)
29952993
sci(__ret)
29962994
return __ret

lib/mpl_toolkits/axes_grid1/axes_grid.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ def __init__(self, *args, orientation, **kwargs):
2525
self._locator = None # deprecated.
2626
super().__init__(*args, **kwargs)
2727

28-
@cbook._rename_parameter("3.2", "locator", "ticks")
2928
def colorbar(self, mappable, *, ticks=None, **kwargs):
3029

3130
if self.orientation in ["top", "bottom"]:

0 commit comments

Comments
 (0)