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

Skip to content

Commit 062223f

Browse files
authored
Merge pull request #15995 from timhoffm/remove-3.1-deprecations3
Remove toolkit functions deprecated in 3.1
2 parents 0f320e5 + 79644a2 commit 062223f

File tree

10 files changed

+57
-288
lines changed

10 files changed

+57
-288
lines changed

doc/api/next_api_changes/removals.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,34 @@ Classes and methods
7171

7272
- ``text.TextWithDash`` (use ``text.Annotation`` instead)
7373

74+
- ``mplot3d.proj3d.line2d()`` (no replacement)
75+
- ``mplot3d.proj3d.line2d_dist()`` (no replacement)
76+
- ``mplot3d.proj3d.line2d_seg_dist()`` (no replacement)
77+
- ``mplot3d.proj3d.mod()`` (use `numpy.linalg.norm` instead)
78+
- ``mplot3d.proj3d.proj_transform_vec()`` (no replacement)
79+
- ``mplot3d.proj3d.proj_transform_vec_clip()`` (no replacement)
80+
- ``mplot3d.proj3d.vec_pad_ones()`` (no replacement)
81+
- ``mplot3d.proj3d.proj_trans_clip_points()`` (no replacement)
82+
83+
- ``mplot3d.art3d.norm_angle()`` (no replacement)
84+
- ``mplot3d.art3d.norm_text_angle()`` (no replacement)
85+
- ``mplot3d.art3d.path_to_3d_segment()`` (no replacement)
86+
- ``mplot3d.art3d.paths_to_3d_segments()`` (no replacement)
87+
- ``mplot3d.art3d.path_to_3d_segment_with_codes()`` (no replacement)
88+
- ``mplot3d.art3d.paths_to_3d_segments_with_codes()`` (no replacement)
89+
- ``mplot3d.art3d.get_patch_verts()`` (no replacement)
90+
- ``mplot3d.art3d.get_colors()`` (no replacement)
91+
- ``mplot3d.art3d.zalpha()`` (no replacement)
92+
93+
- ``mplot3d.axis3d.get_flip_min_max()`` (no replacement)
94+
- ``mplot3d.axis3d.Axis.get_tick_positions()`` (no replacement)
95+
96+
- ``axisartist.axis_artist.UnimplementedException`` (no replacement)
97+
- ``axisartist.axislines.SimpleChainedObjects``
98+
(use ``axis_grid1.mpl_axes.SimpleChainedObjects`` instead)
99+
- ``axisartist.axislines.Axes.AxisDict``
100+
(use ``axis_grid1.mpl_axes.Axes.AxisDict`` instead)
101+
74102
Arguments
75103
~~~~~~~~~
76104
- ``Axes.text()`` / ``pyplot.text()`` do not support the parameter ``withdash``

doc/api/prev_api_changes/api_changes_1.2.x.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Changes in 1.2.x
4141

4242
* Use of ``matplotlib.projections.projection_factory`` is now deprecated
4343
in favour of axes class identification using
44-
:func:`~matplotlib.projections.process_projection_requirements` followed by
44+
``matplotlib.projections.process_projection_requirements`` followed by
4545
direct axes class invocation (at the time of writing, functions which do this
4646
are: :meth:`~matplotlib.figure.Figure.add_axes`,
4747
:meth:`~matplotlib.figure.Figure.add_subplot` and

doc/api/prev_api_changes/api_changes_3.1.0.rst

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ required methods.
824824

825825
This has not been used in the codebase since its addition in 2009.
826826

827-
- `.axis3d.Axis.get_tick_positions`
827+
- ``axis3d.Axis.get_tick_positions``
828828

829829
This has never been used internally, there is no equivalent method exists on
830830
the 2D Axis classes, and despite the similar name, it has a completely
@@ -863,7 +863,7 @@ Use the standard library's docstring manipulation tools instead, such as
863863
These are considered internal and will be removed from the public API in a
864864
future version.
865865

866-
- `.projections.process_projection_requirements`
866+
- ``projections.process_projection_requirements``
867867

868868
- ``backend_ps.PsBackendHelper``
869869
- ``backend_ps.ps_backend_helper``,
@@ -883,26 +883,26 @@ of `.mpl_toolkits.mplot3d` are deprecated,
883883

884884
**mpl_toolkits.mplot3d.art3d**
885885

886-
- :func:`mpl_toolkits.mplot3d.art3d.norm_angle`
887-
- :func:`mpl_toolkits.mplot3d.art3d.norm_text_angle`
888-
- :func:`mpl_toolkits.mplot3d.art3d.path_to_3d_segment`
889-
- :func:`mpl_toolkits.mplot3d.art3d.paths_to_3d_segments`
890-
- :func:`mpl_toolkits.mplot3d.art3d.path_to_3d_segment_with_codes`
891-
- :func:`mpl_toolkits.mplot3d.art3d.paths_to_3d_segments_with_codes`
892-
- :func:`mpl_toolkits.mplot3d.art3d.get_patch_verts`
893-
- :func:`mpl_toolkits.mplot3d.art3d.get_colors`
894-
- :func:`mpl_toolkits.mplot3d.art3d.zalpha`
886+
- ``mpl_toolkits.mplot3d.art3d.norm_angle``
887+
- ``mpl_toolkits.mplot3d.art3d.norm_text_angle``
888+
- ``mpl_toolkits.mplot3d.art3d.path_to_3d_segment``
889+
- ``mpl_toolkits.mplot3d.art3d.paths_to_3d_segments``
890+
- ``mpl_toolkits.mplot3d.art3d.path_to_3d_segment_with_codes``
891+
- ``mpl_toolkits.mplot3d.art3d.paths_to_3d_segments_with_codes``
892+
- ``mpl_toolkits.mplot3d.art3d.get_patch_verts``
893+
- ``mpl_toolkits.mplot3d.art3d.get_colors``
894+
- ``mpl_toolkits.mplot3d.art3d.zalpha``
895895

896896
**mpl_toolkits.mplot3d.proj3d**
897897

898-
- :func:`mpl_toolkits.mplot3d.proj3d.line2d`
899-
- :func:`mpl_toolkits.mplot3d.proj3d.line2d_dist`
900-
- :func:`mpl_toolkits.mplot3d.proj3d.line2d_seg_dist`
901-
- :func:`mpl_toolkits.mplot3d.proj3d.mod`
902-
- :func:`mpl_toolkits.mplot3d.proj3d.proj_transform_vec`
903-
- :func:`mpl_toolkits.mplot3d.proj3d.proj_transform_vec_clip`
904-
- :func:`mpl_toolkits.mplot3d.proj3d.vec_pad_ones`
905-
- :func:`mpl_toolkits.mplot3d.proj3d.proj_trans_clip_points`
898+
- ``mpl_toolkits.mplot3d.proj3d.line2d``
899+
- ``mpl_toolkits.mplot3d.proj3d.line2d_dist``
900+
- ``mpl_toolkits.mplot3d.proj3d.line2d_seg_dist``
901+
- ``mpl_toolkits.mplot3d.proj3d.mod``
902+
- ``mpl_toolkits.mplot3d.proj3d.proj_transform_vec``
903+
- ``mpl_toolkits.mplot3d.proj3d.proj_transform_vec_clip``
904+
- ``mpl_toolkits.mplot3d.proj3d.vec_pad_ones``
905+
- ``mpl_toolkits.mplot3d.proj3d.proj_trans_clip_points``
906906

907907
If your project relies on these functions, consider vendoring them.
908908

@@ -944,7 +944,7 @@ instead.
944944
Testing
945945
~~~~~~~
946946

947-
- `matplotlib.testing.decorators.switch_backend` decorator
947+
- ``matplotlib.testing.decorators.switch_backend`` decorator
948948

949949
Test functions should use `pytest.mark.backend(...)`, and the mark will be
950950
picked up by the `matplotlib.testing.conftest.mpl_test_settings` fixture.
@@ -971,7 +971,7 @@ GUI / backend details
971971
This is unused and only relevant to the now removed wx "idling" code (note that
972972
as it is a module-level global, no deprecation warning is emitted when
973973
accessing it).
974-
- `.mlab.demean`
974+
- ``mlab.demean``
975975
- ``backend_gtk3cairo.FigureCanvasGTK3Cairo``,
976976
- ``backend_wx.debug_on_error``, ``backend_wx.fake_stderr``,
977977
``backend_wx.raise_msg_to_str``, ``backend_wx.MenuButtonWx``,
@@ -1015,7 +1015,7 @@ formatter classes.
10151015
Path tools
10161016
~~~~~~~~~~
10171017

1018-
- `.path.get_paths_extents`
1018+
- ``path.get_paths_extents``
10191019

10201020
Use `~.path.get_path_collection_extents` instead.
10211021

@@ -1031,9 +1031,9 @@ Text
10311031
~~~~
10321032

10331033
- ``text.TextWithDash``
1034-
- `.Text.is_math_text`
1035-
- `.TextPath.is_math_text`
1036-
- `.TextPath.text_get_vertices_codes` (As an alternative, construct a new ``TextPath`` object.)
1034+
- ``Text.is_math_text``
1035+
- ``TextPath.is_math_text``
1036+
- ``TextPath.text_get_vertices_codes`` (As an alternative, construct a new ``TextPath`` object.)
10371037

10381038
Unused attributes
10391039
~~~~~~~~~~~~~~~~~

doc/api/toolkits/mplot3d.rst

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -79,25 +79,16 @@ Art3D Utility Functions
7979
:toctree: ../_as_gen
8080
:template: autosummary.rst
8181

82-
art3d.get_colors
8382
art3d.get_dir_vector
84-
art3d.get_patch_verts
8583
art3d.juggle_axes
8684
art3d.line_2d_to_3d
8785
art3d.line_collection_2d_to_3d
88-
art3d.norm_angle
89-
art3d.norm_text_angle
9086
art3d.patch_2d_to_3d
9187
art3d.patch_collection_2d_to_3d
92-
art3d.path_to_3d_segment
93-
art3d.path_to_3d_segment_with_codes
9488
art3d.pathpatch_2d_to_3d
95-
art3d.paths_to_3d_segments
96-
art3d.paths_to_3d_segments_with_codes
9789
art3d.poly_collection_2d_to_3d
9890
art3d.rotate_axes
9991
art3d.text_2d_to_3d
100-
art3d.zalpha
10192

10293
.. _toolkit_mplot3d-projapi:
10394

@@ -109,20 +100,12 @@ Art3D Utility Functions
109100
:template: autosummary.rst
110101

111102
proj3d.inv_transform
112-
proj3d.line2d
113-
proj3d.line2d_dist
114-
proj3d.line2d_seg_dist
115-
proj3d.mod
116103
proj3d.persp_transformation
117104
proj3d.proj_points
118-
proj3d.proj_trans_clip_points
119105
proj3d.proj_trans_points
120106
proj3d.proj_transform
121107
proj3d.proj_transform_clip
122-
proj3d.proj_transform_vec
123-
proj3d.proj_transform_vec_clip
124108
proj3d.rot_x
125109
proj3d.transform
126-
proj3d.vec_pad_ones
127110
proj3d.view_transformation
128111
proj3d.world_transformation

lib/mpl_toolkits/axisartist/axis_artist.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,6 @@ def draw(self, renderer):
157157
renderer.close_group('line2d')
158158

159159

160-
@cbook.deprecated("3.1")
161-
class UnimplementedException(Exception):
162-
pass
163-
164-
165160
class AttributeCopier:
166161
@cbook.deprecated("3.2")
167162
def __init__(self, ref_artist, klass=Artist):

lib/mpl_toolkits/axisartist/axislines.py

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -452,42 +452,10 @@ def get_gridlines(self, which="major", axis="both"):
452452
return gridlines
453453

454454

455-
@cbook.deprecated("3.1")
456-
class SimpleChainedObjects:
457-
def __init__(self, objects):
458-
self._objects = objects
459-
460-
def __getattr__(self, k):
461-
_a = SimpleChainedObjects([getattr(a, k) for a in self._objects])
462-
return _a
463-
464-
def __call__(self, *args, **kwargs):
465-
for m in self._objects:
466-
m(*args, **kwargs)
467-
468-
469455
class Axes(maxes.Axes):
470456

471-
@cbook.deprecated("3.1")
472-
class AxisDict(dict):
473-
def __init__(self, axes):
474-
self.axes = axes
475-
super().__init__()
476-
477-
def __getitem__(self, k):
478-
if isinstance(k, tuple):
479-
return SimpleChainedObjects(
480-
[dict.__getitem__(self, k1) for k1 in k])
481-
elif isinstance(k, slice):
482-
if k == slice(None):
483-
return SimpleChainedObjects(list(self.values()))
484-
else:
485-
raise ValueError("Unsupported slice")
486-
else:
487-
return dict.__getitem__(self, k)
488-
489-
def __call__(self, *args, **kwargs):
490-
return maxes.Axes.axis(self.axes, *args, **kwargs)
457+
def __call__(self, *args, **kwargs):
458+
return maxes.Axes.axis(self.axes, *args, **kwargs)
491459

492460
def __init__(self, *args, grid_helper=None, **kwargs):
493461
self._axisline_on = True

lib/mpl_toolkits/mplot3d/art3d.py

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ def _norm_angle(a):
2828
return a
2929

3030

31-
@cbook.deprecated("3.1")
32-
def norm_angle(a):
33-
"""Return the given angle normalized to -180 < *a* <= 180 degrees."""
34-
return _norm_angle(a)
35-
36-
3731
def _norm_text_angle(a):
3832
"""Return the given angle normalized to -90 < *a* <= 90 degrees."""
3933
a = (a + 180) % 180
@@ -42,12 +36,6 @@ def _norm_text_angle(a):
4236
return a
4337

4438

45-
@cbook.deprecated("3.1")
46-
def norm_text_angle(a):
47-
"""Return the given angle normalized to -90 < *a* <= 90 degrees."""
48-
return _norm_text_angle(a)
49-
50-
5139
def get_dir_vector(zdir):
5240
"""
5341
Return a direction vector.
@@ -216,12 +204,6 @@ def _path_to_3d_segment(path, zs=0, zdir='z'):
216204
return seg3d
217205

218206

219-
@cbook.deprecated("3.1")
220-
def path_to_3d_segment(path, zs=0, zdir='z'):
221-
"""Convert a path to a 3D segment."""
222-
return _path_to_3d_segment(path, zs=zs, zdir=zdir)
223-
224-
225207
def _paths_to_3d_segments(paths, zs=0, zdir='z'):
226208
"""Convert paths from a collection object to 3D segments."""
227209

@@ -231,12 +213,6 @@ def _paths_to_3d_segments(paths, zs=0, zdir='z'):
231213
return segs
232214

233215

234-
@cbook.deprecated("3.1")
235-
def paths_to_3d_segments(paths, zs=0, zdir='z'):
236-
"""Convert paths from a collection object to 3D segments."""
237-
return _paths_to_3d_segments(paths, zs=zs, zdir=zdir)
238-
239-
240216
def _path_to_3d_segment_with_codes(path, zs=0, zdir='z'):
241217
"""Convert a path to a 3D segment with path codes."""
242218

@@ -252,12 +228,6 @@ def _path_to_3d_segment_with_codes(path, zs=0, zdir='z'):
252228
return seg3d, list(codes)
253229

254230

255-
@cbook.deprecated("3.1")
256-
def path_to_3d_segment_with_codes(path, zs=0, zdir='z'):
257-
"""Convert a path to a 3D segment with path codes."""
258-
return _path_to_3d_segment_with_codes(path, zs=zs, zdir=zdir)
259-
260-
261231
def _paths_to_3d_segments_with_codes(paths, zs=0, zdir='z'):
262232
"""
263233
Convert paths from a collection object to 3D segments with path codes.
@@ -273,14 +243,6 @@ def _paths_to_3d_segments_with_codes(paths, zs=0, zdir='z'):
273243
return list(segments), list(codes)
274244

275245

276-
@cbook.deprecated("3.1")
277-
def paths_to_3d_segments_with_codes(paths, zs=0, zdir='z'):
278-
"""
279-
Convert paths from a collection object to 3D segments with path codes.
280-
"""
281-
return _paths_to_3d_segments_with_codes(paths, zs=zs, zdir=zdir)
282-
283-
284246
class Line3DCollection(LineCollection):
285247
"""
286248
A collection of 3D lines.
@@ -393,12 +355,6 @@ def _get_patch_verts(patch):
393355
return []
394356

395357

396-
@cbook.deprecated("3.1")
397-
def get_patch_verts(patch):
398-
"""Return a list of vertices for the path of a patch."""
399-
return _get_patch_verts(patch)
400-
401-
402358
def patch_2d_to_3d(patch, z=0, zdir='z'):
403359
"""Convert a Patch to a Patch3D object."""
404360
verts = _get_patch_verts(patch)
@@ -800,12 +756,6 @@ def _get_colors(c, num):
800756
(num, 4))
801757

802758

803-
@cbook.deprecated("3.1")
804-
def get_colors(c, num):
805-
"""Stretch the color argument to provide the required number *num*."""
806-
return _get_colors(c, num)
807-
808-
809759
def _zalpha(colors, zs):
810760
"""Modify the alphas of the color list according to depth."""
811761
# FIXME: This only works well if the points for *zs* are well-spaced
@@ -818,9 +768,3 @@ def _zalpha(colors, zs):
818768
sats = 1 - norm(zs) * 0.7
819769
rgba = np.broadcast_to(mcolors.to_rgba_array(colors), (len(zs), 4))
820770
return np.column_stack([rgba[:, :3], rgba[:, 3] * sats])
821-
822-
823-
@cbook.deprecated("3.1")
824-
def zalpha(colors, zs):
825-
"""Modify the alphas of the color list according to depth."""
826-
return _zalpha(colors, zs)

lib/mpl_toolkits/mplot3d/axis3d.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,10 @@
55
import numpy as np
66

77
from matplotlib import (
8-
artist, cbook, lines as mlines, axis as maxis, patches as mpatches,
9-
rcParams)
8+
artist, lines as mlines, axis as maxis, patches as mpatches, rcParams)
109
from . import art3d, proj3d
1110

1211

13-
@cbook.deprecated("3.1")
14-
def get_flip_min_max(coord, index, mins, maxs):
15-
if coord[index] == mins[index]:
16-
return maxs[index]
17-
else:
18-
return mins[index]
19-
20-
2112
def move_from_center(coord, centers, deltas, axmask=(True, True, True)):
2213
"""
2314
For each coordinate where *axmask* is True, move *coord* away from
@@ -126,12 +117,6 @@ def init3d(self):
126117
self.label._transform = self.axes.transData
127118
self.offsetText._transform = self.axes.transData
128119

129-
@cbook.deprecated("3.1")
130-
def get_tick_positions(self):
131-
majorLocs = self.major.locator()
132-
majorLabels = self.major.formatter.format_ticks(majorLocs)
133-
return majorLabels, majorLocs
134-
135120
def get_major_ticks(self, numticks=None):
136121
ticks = maxis.XAxis.get_major_ticks(self, numticks)
137122
for t in ticks:

0 commit comments

Comments
 (0)