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

Skip to content

Commit a70d650

Browse files
authored
Merge pull request #28183 from oscargus/axisandmore
Expire deprecations
2 parents 0cf6e20 + f6b8a1b commit a70d650

File tree

22 files changed

+85
-168
lines changed

22 files changed

+85
-168
lines changed

doc/api/axis_api.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ Other
217217
Axis.axes
218218
Axis.limit_range_for_scale
219219
Axis.reset_ticks
220+
Axis.set_clip_path
220221
Axis.set_default_intervals
221222

222223
Discouraged
@@ -263,8 +264,7 @@ specify a matching series of labels. Calling ``set_ticks`` makes a
263264
Tick.get_tick_padding
264265
Tick.get_tickdir
265266
Tick.get_view_interval
266-
Tick.set_label1
267-
Tick.set_label2
267+
Tick.set_clip_path
268268
Tick.set_pad
269269
Tick.set_url
270270
Tick.update_position
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
``Tick.set_label``, ``Tick.set_label1`` and ``Tick.set_label2``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
... are removed. Calling these methods from third-party code usually had no
4+
effect, as the labels are overwritten at draw time by the tick formatter.
5+
6+
7+
Functions in ``mpl_toolkits.mplot3d.proj3d``
8+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9+
10+
The function ``transform`` is just an alias for ``proj_transform``,
11+
use the latter instead.
12+
13+
The following functions were either unused (so no longer required in Matplotlib)
14+
or considered private.
15+
16+
* ``ortho_transformation``
17+
* ``persp_transformation``
18+
* ``proj_points``
19+
* ``proj_trans_points``
20+
* ``rot_x``
21+
* ``rotation_about_vector``
22+
* ``view_transformation``
23+
24+
25+
Arguments other than ``renderer`` to ``get_tightbbox``
26+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27+
28+
... are keyword-only arguments. This is for consistency and that
29+
different classes have different additional arguments.
30+
31+
32+
Method parameters renamed to match base classes
33+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
34+
35+
The only parameter of ``transform_affine`` and ``transform_non_affine`` in ``Transform`` subclasses is renamed
36+
to *values*.
37+
38+
The *points* parameter of ``transforms.IdentityTransform.transform`` is renamed to *values*.
39+
40+
The *trans* parameter of ``table.Cell.set_transform`` is renamed to *t* consistently with
41+
`.Artist.set_transform`.
42+
43+
The *clippath* parameters of ``axis.Axis.set_clip_path`` and ``axis.Tick.set_clip_path`` are
44+
renamed to *path* consistently with `.Artist.set_clip_path`.
45+
46+
The *s* parameter of ``images.NonUniformImage.set_filternorm`` is renamed to *filternorm*
47+
consistently with ``_ImageBase.set_filternorm``.
48+
49+
The *s* parameter of ``images.NonUniformImage.set_filterrad`` is renamed to *filterrad*
50+
consistently with ``_ImageBase.set_filterrad``.
51+
52+
The only parameter of ``Annotation.contains`` and ``Legend.contains`` is renamed to *mouseevent*
53+
consistently with `.Artist.contains`.
54+
55+
Method parameters renamed
56+
~~~~~~~~~~~~~~~~~~~~~~~~~
57+
58+
The *p* parameter of ``BboxBase.padded`` is renamed to *w_pad*, consistently with the other parameter, *h_pad*
59+
60+
*numdecs* parameter and attribute of ``LogLocator``
61+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
62+
... are removed without replacement, because they had no effect.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,10 @@ The *clippath* parameters of ``axis.Axis.set_clip_path`` and ``axis.Tick.set_cl
153153
renamed to *path* consistently with `.Artist.set_clip_path`.
154154

155155
The *s* parameter of ``images.NonUniformImage.set_filternorm`` is renamed to *filternorm*
156-
consistently with ```_ImageBase.set_filternorm``.
156+
consistently with ``_ImageBase.set_filternorm``.
157157

158158
The *s* parameter of ``images.NonUniformImage.set_filterrad`` is renamed to *filterrad*
159-
consistently with ```_ImageBase.set_filterrad``.
159+
consistently with ``_ImageBase.set_filterrad``.
160160

161161

162162
*numdecs* parameter and attribute of ``LogLocator``

doc/api/toolkits/mplot3d.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,6 @@ the toolbar pan and zoom buttons are not used.
118118
:template: autosummary.rst
119119

120120
proj3d.inv_transform
121-
proj3d.persp_transformation
122-
proj3d.proj_points
123-
proj3d.proj_trans_points
124121
proj3d.proj_transform
125122
proj3d.proj_transform_clip
126-
proj3d.rot_x
127-
proj3d.transform
128-
proj3d.view_transformation
129123
proj3d.world_transformation

lib/matplotlib/axes/_base.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4425,9 +4425,8 @@ def get_default_bbox_extra_artists(self):
44254425
return [a for a in artists if a.get_visible() and a.get_in_layout()
44264426
and (isinstance(a, noclip) or not a._fully_clipped_to_axes())]
44274427

4428-
@_api.make_keyword_only("3.8", "call_axes_locator")
4429-
def get_tightbbox(self, renderer=None, call_axes_locator=True,
4430-
bbox_extra_artists=None, *, for_layout_only=False):
4428+
def get_tightbbox(self, renderer=None, *, call_axes_locator=True,
4429+
bbox_extra_artists=None, for_layout_only=False):
44314430
"""
44324431
Return the tight bounding box of the Axes, including axis and their
44334432
decorators (xlabel, title, etc).

lib/matplotlib/axis.py

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ def get_children(self):
231231
self.gridline, self.label1, self.label2]
232232
return children
233233

234-
@_api.rename_parameter("3.8", "clippath", "path")
235234
def set_clip_path(self, path, transform=None):
236235
# docstring inherited
237236
super().set_clip_path(path, transform)
@@ -278,32 +277,6 @@ def draw(self, renderer):
278277
renderer.close_group(self.__name__)
279278
self.stale = False
280279

281-
@_api.deprecated("3.8")
282-
def set_label1(self, s):
283-
"""
284-
Set the label1 text.
285-
286-
Parameters
287-
----------
288-
s : str
289-
"""
290-
self.label1.set_text(s)
291-
self.stale = True
292-
293-
set_label = set_label1
294-
295-
@_api.deprecated("3.8")
296-
def set_label2(self, s):
297-
"""
298-
Set the label2 text.
299-
300-
Parameters
301-
----------
302-
s : str
303-
"""
304-
self.label2.set_text(s)
305-
self.stale = True
306-
307280
def set_url(self, url):
308281
"""
309282
Set the url of label1 and label2.
@@ -833,6 +806,10 @@ def _set_axes_scale(self, value, **kwargs):
833806
**{f"scale{k}": k == name for k in self.axes._axis_names})
834807

835808
def limit_range_for_scale(self, vmin, vmax):
809+
"""
810+
Return the range *vmin*, *vmax*, restricted to the domain supported by the
811+
current scale.
812+
"""
836813
return self._scale.limit_range_for_scale(vmin, vmax, self.get_minpos())
837814

838815
def _get_autoscale_on(self):
@@ -841,8 +818,9 @@ def _get_autoscale_on(self):
841818

842819
def _set_autoscale_on(self, b):
843820
"""
844-
Set whether this Axis is autoscaled when drawing or by
845-
`.Axes.autoscale_view`. If b is None, then the value is not changed.
821+
Set whether this Axis is autoscaled when drawing or by `.Axes.autoscale_view`.
822+
823+
If b is None, then the value is not changed.
846824
847825
Parameters
848826
----------
@@ -1131,7 +1109,6 @@ def _translate_tick_params(kw, reverse=False):
11311109
kwtrans.update(kw_)
11321110
return kwtrans
11331111

1134-
@_api.rename_parameter("3.8", "clippath", "path")
11351112
def set_clip_path(self, path, transform=None):
11361113
super().set_clip_path(path, transform)
11371114
for child in self.majorTicks + self.minorTicks:

lib/matplotlib/axis.pyi

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ class Tick(martist.Artist):
6060
def set_pad(self, val: float) -> None: ...
6161
def get_pad(self) -> None: ...
6262
def get_loc(self) -> float: ...
63-
def set_label1(self, s: object) -> None: ...
64-
def set_label(self, s: object) -> None: ...
65-
def set_label2(self, s: object) -> None: ...
6663
def set_url(self, url: str | None) -> None: ...
6764
def get_view_interval(self) -> ArrayLike: ...
6865
def update_position(self, loc: float) -> None: ...

lib/matplotlib/figure.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1797,8 +1797,7 @@ def get_default_bbox_extra_artists(self):
17971797
bbox_artists.extend(ax.get_default_bbox_extra_artists())
17981798
return bbox_artists
17991799

1800-
@_api.make_keyword_only("3.8", "bbox_extra_artists")
1801-
def get_tightbbox(self, renderer=None, bbox_extra_artists=None):
1800+
def get_tightbbox(self, renderer=None, *, bbox_extra_artists=None):
18021801
"""
18031802
Return a (tight) bounding box of the figure *in inches*.
18041803

lib/matplotlib/image.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,11 +1129,9 @@ def get_extent(self):
11291129
raise RuntimeError('Must set data first')
11301130
return self._Ax[0], self._Ax[-1], self._Ay[0], self._Ay[-1]
11311131

1132-
@_api.rename_parameter("3.8", "s", "filternorm")
11331132
def set_filternorm(self, filternorm):
11341133
pass
11351134

1136-
@_api.rename_parameter("3.8", "s", "filterrad")
11371135
def set_filterrad(self, filterrad):
11381136
pass
11391137

lib/matplotlib/legend.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,6 @@ def _find_best_position(self, width, height, renderer):
11961196

11971197
return l, b
11981198

1199-
@_api.rename_parameter("3.8", "event", "mouseevent")
12001199
def contains(self, mouseevent):
12011200
return self.legendPatch.contains(mouseevent)
12021201

lib/matplotlib/projections/geo.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@ class AitoffAxes(GeoAxes):
258258
class AitoffTransform(_GeoTransform):
259259
"""The base Aitoff transform."""
260260

261-
@_api.rename_parameter("3.8", "ll", "values")
262261
def transform_non_affine(self, values):
263262
# docstring inherited
264263
longitude, latitude = values.T
@@ -280,7 +279,6 @@ def inverted(self):
280279

281280
class InvertedAitoffTransform(_GeoTransform):
282281

283-
@_api.rename_parameter("3.8", "xy", "values")
284282
def transform_non_affine(self, values):
285283
# docstring inherited
286284
# MGDTODO: Math is hard ;(
@@ -306,7 +304,6 @@ class HammerAxes(GeoAxes):
306304
class HammerTransform(_GeoTransform):
307305
"""The base Hammer transform."""
308306

309-
@_api.rename_parameter("3.8", "ll", "values")
310307
def transform_non_affine(self, values):
311308
# docstring inherited
312309
longitude, latitude = values.T
@@ -324,7 +321,6 @@ def inverted(self):
324321

325322
class InvertedHammerTransform(_GeoTransform):
326323

327-
@_api.rename_parameter("3.8", "xy", "values")
328324
def transform_non_affine(self, values):
329325
# docstring inherited
330326
x, y = values.T
@@ -353,7 +349,6 @@ class MollweideAxes(GeoAxes):
353349
class MollweideTransform(_GeoTransform):
354350
"""The base Mollweide transform."""
355351

356-
@_api.rename_parameter("3.8", "ll", "values")
357352
def transform_non_affine(self, values):
358353
# docstring inherited
359354
def d(theta):
@@ -394,7 +389,6 @@ def inverted(self):
394389

395390
class InvertedMollweideTransform(_GeoTransform):
396391

397-
@_api.rename_parameter("3.8", "xy", "values")
398392
def transform_non_affine(self, values):
399393
# docstring inherited
400394
x, y = values.T
@@ -435,7 +429,6 @@ def __init__(self, center_longitude, center_latitude, resolution):
435429
self._center_longitude = center_longitude
436430
self._center_latitude = center_latitude
437431

438-
@_api.rename_parameter("3.8", "ll", "values")
439432
def transform_non_affine(self, values):
440433
# docstring inherited
441434
longitude, latitude = values.T
@@ -469,7 +462,6 @@ def __init__(self, center_longitude, center_latitude, resolution):
469462
self._center_longitude = center_longitude
470463
self._center_latitude = center_latitude
471464

472-
@_api.rename_parameter("3.8", "xy", "values")
473465
def transform_non_affine(self, values):
474466
# docstring inherited
475467
x, y = values.T

lib/matplotlib/projections/polar.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ def _get_rorigin(self):
7979
return self._scale_transform.transform(
8080
(0, self._axis.get_rorigin()))[1]
8181

82-
@_api.rename_parameter("3.8", "tr", "values")
8382
def transform_non_affine(self, values):
8483
# docstring inherited
8584
theta, r = np.transpose(values)
@@ -235,7 +234,6 @@ def __init__(self, axis=None, use_rmin=True,
235234
use_rmin="_use_rmin",
236235
apply_theta_transforms="_apply_theta_transforms")
237236

238-
@_api.rename_parameter("3.8", "xy", "values")
239237
def transform_non_affine(self, values):
240238
# docstring inherited
241239
x, y = values.T

lib/matplotlib/scale.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ def __str__(self):
213213
return "{}(base={}, nonpositive={!r})".format(
214214
type(self).__name__, self.base, "clip" if self._clip else "mask")
215215

216-
@_api.rename_parameter("3.8", "a", "values")
217216
def transform_non_affine(self, values):
218217
# Ignore invalid values due to nans being passed to the transform.
219218
with np.errstate(divide="ignore", invalid="ignore"):
@@ -250,7 +249,6 @@ def __init__(self, base):
250249
def __str__(self):
251250
return f"{type(self).__name__}(base={self.base})"
252251

253-
@_api.rename_parameter("3.8", "a", "values")
254252
def transform_non_affine(self, values):
255253
return np.power(self.base, values)
256254

@@ -362,7 +360,6 @@ def __init__(self, base, linthresh, linscale):
362360
self._linscale_adj = (linscale / (1.0 - self.base ** -1))
363361
self._log_base = np.log(base)
364362

365-
@_api.rename_parameter("3.8", "a", "values")
366363
def transform_non_affine(self, values):
367364
abs_a = np.abs(values)
368365
with np.errstate(divide="ignore", invalid="ignore"):
@@ -390,7 +387,6 @@ def __init__(self, base, linthresh, linscale):
390387
self.linscale = linscale
391388
self._linscale_adj = (linscale / (1.0 - self.base ** -1))
392389

393-
@_api.rename_parameter("3.8", "a", "values")
394390
def transform_non_affine(self, values):
395391
abs_a = np.abs(values)
396392
with np.errstate(divide="ignore", invalid="ignore"):
@@ -472,7 +468,6 @@ def __init__(self, linear_width):
472468
"must be strictly positive")
473469
self.linear_width = linear_width
474470

475-
@_api.rename_parameter("3.8", "a", "values")
476471
def transform_non_affine(self, values):
477472
return self.linear_width * np.arcsinh(values / self.linear_width)
478473

@@ -488,7 +483,6 @@ def __init__(self, linear_width):
488483
super().__init__()
489484
self.linear_width = linear_width
490485

491-
@_api.rename_parameter("3.8", "a", "values")
492486
def transform_non_affine(self, values):
493487
return self.linear_width * np.sinh(values / self.linear_width)
494488

@@ -589,7 +583,6 @@ def __init__(self, nonpositive='mask'):
589583
self._nonpositive = nonpositive
590584
self._clip = {"clip": True, "mask": False}[nonpositive]
591585

592-
@_api.rename_parameter("3.8", "a", "values")
593586
def transform_non_affine(self, values):
594587
"""logit transform (base 10), masked or clipped"""
595588
with np.errstate(divide="ignore", invalid="ignore"):
@@ -613,7 +606,6 @@ def __init__(self, nonpositive='mask'):
613606
super().__init__()
614607
self._nonpositive = nonpositive
615608

616-
@_api.rename_parameter("3.8", "a", "values")
617609
def transform_non_affine(self, values):
618610
"""logistic transform (base 10)"""
619611
return 1.0 / (1 + 10**(-values))

lib/matplotlib/table.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ def __init__(self, xy, width, height, *,
103103
text=text, fontproperties=fontproperties,
104104
horizontalalignment=loc, verticalalignment='center')
105105

106-
@_api.rename_parameter("3.8", "trans", "t")
107106
def set_transform(self, t):
108107
super().set_transform(t)
109108
# the text does not get the transform!

0 commit comments

Comments
 (0)