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

Skip to content

Remove toolkit functions deprecated in 3.1 #15995

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 1 commit into from
Dec 23, 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
28 changes: 28 additions & 0 deletions doc/api/next_api_changes/removals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,34 @@ Classes and methods

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

- ``mplot3d.proj3d.line2d()`` (no replacement)
- ``mplot3d.proj3d.line2d_dist()`` (no replacement)
- ``mplot3d.proj3d.line2d_seg_dist()`` (no replacement)
- ``mplot3d.proj3d.mod()`` (use `numpy.linalg.norm` instead)
- ``mplot3d.proj3d.proj_transform_vec()`` (no replacement)
- ``mplot3d.proj3d.proj_transform_vec_clip()`` (no replacement)
- ``mplot3d.proj3d.vec_pad_ones()`` (no replacement)
- ``mplot3d.proj3d.proj_trans_clip_points()`` (no replacement)

- ``mplot3d.art3d.norm_angle()`` (no replacement)
- ``mplot3d.art3d.norm_text_angle()`` (no replacement)
- ``mplot3d.art3d.path_to_3d_segment()`` (no replacement)
- ``mplot3d.art3d.paths_to_3d_segments()`` (no replacement)
- ``mplot3d.art3d.path_to_3d_segment_with_codes()`` (no replacement)
- ``mplot3d.art3d.paths_to_3d_segments_with_codes()`` (no replacement)
- ``mplot3d.art3d.get_patch_verts()`` (no replacement)
- ``mplot3d.art3d.get_colors()`` (no replacement)
- ``mplot3d.art3d.zalpha()`` (no replacement)

- ``mplot3d.axis3d.get_flip_min_max()`` (no replacement)
- ``mplot3d.axis3d.Axis.get_tick_positions()`` (no replacement)

- ``axisartist.axis_artist.UnimplementedException`` (no replacement)
- ``axisartist.axislines.SimpleChainedObjects``
(use ``axis_grid1.mpl_axes.SimpleChainedObjects`` instead)
- ``axisartist.axislines.Axes.AxisDict``
(use ``axis_grid1.mpl_axes.Axes.AxisDict`` instead)

Arguments
~~~~~~~~~
- ``Axes.text()`` / ``pyplot.text()`` do not support the parameter ``withdash``
Expand Down
2 changes: 1 addition & 1 deletion doc/api/prev_api_changes/api_changes_1.2.x.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Changes in 1.2.x

* Use of ``matplotlib.projections.projection_factory`` is now deprecated
in favour of axes class identification using
:func:`~matplotlib.projections.process_projection_requirements` followed by
``matplotlib.projections.process_projection_requirements`` followed by
direct axes class invocation (at the time of writing, functions which do this
are: :meth:`~matplotlib.figure.Figure.add_axes`,
:meth:`~matplotlib.figure.Figure.add_subplot` and
Expand Down
50 changes: 25 additions & 25 deletions doc/api/prev_api_changes/api_changes_3.1.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ required methods.

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

- `.axis3d.Axis.get_tick_positions`
- ``axis3d.Axis.get_tick_positions``

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

- `.projections.process_projection_requirements`
- ``projections.process_projection_requirements``
Copy link
Contributor

Choose a reason for hiding this comment

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

these should technically be in a separate PR but I'm not going to be nitpicky with that.

Copy link
Member Author

Choose a reason for hiding this comment

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

If one wants to be very strict yes, but it's just changing link to literal, which can be done anytime is not strictly related to the deprecation of that function. I saved the hassle of cherry-pickling parts of the file. 😄


- ``backend_ps.PsBackendHelper``
- ``backend_ps.ps_backend_helper``,
Expand All @@ -883,26 +883,26 @@ of `.mpl_toolkits.mplot3d` are deprecated,

**mpl_toolkits.mplot3d.art3d**

- :func:`mpl_toolkits.mplot3d.art3d.norm_angle`
- :func:`mpl_toolkits.mplot3d.art3d.norm_text_angle`
- :func:`mpl_toolkits.mplot3d.art3d.path_to_3d_segment`
- :func:`mpl_toolkits.mplot3d.art3d.paths_to_3d_segments`
- :func:`mpl_toolkits.mplot3d.art3d.path_to_3d_segment_with_codes`
- :func:`mpl_toolkits.mplot3d.art3d.paths_to_3d_segments_with_codes`
- :func:`mpl_toolkits.mplot3d.art3d.get_patch_verts`
- :func:`mpl_toolkits.mplot3d.art3d.get_colors`
- :func:`mpl_toolkits.mplot3d.art3d.zalpha`
- ``mpl_toolkits.mplot3d.art3d.norm_angle``
- ``mpl_toolkits.mplot3d.art3d.norm_text_angle``
- ``mpl_toolkits.mplot3d.art3d.path_to_3d_segment``
- ``mpl_toolkits.mplot3d.art3d.paths_to_3d_segments``
- ``mpl_toolkits.mplot3d.art3d.path_to_3d_segment_with_codes``
- ``mpl_toolkits.mplot3d.art3d.paths_to_3d_segments_with_codes``
- ``mpl_toolkits.mplot3d.art3d.get_patch_verts``
- ``mpl_toolkits.mplot3d.art3d.get_colors``
- ``mpl_toolkits.mplot3d.art3d.zalpha``

**mpl_toolkits.mplot3d.proj3d**

- :func:`mpl_toolkits.mplot3d.proj3d.line2d`
- :func:`mpl_toolkits.mplot3d.proj3d.line2d_dist`
- :func:`mpl_toolkits.mplot3d.proj3d.line2d_seg_dist`
- :func:`mpl_toolkits.mplot3d.proj3d.mod`
- :func:`mpl_toolkits.mplot3d.proj3d.proj_transform_vec`
- :func:`mpl_toolkits.mplot3d.proj3d.proj_transform_vec_clip`
- :func:`mpl_toolkits.mplot3d.proj3d.vec_pad_ones`
- :func:`mpl_toolkits.mplot3d.proj3d.proj_trans_clip_points`
- ``mpl_toolkits.mplot3d.proj3d.line2d``
- ``mpl_toolkits.mplot3d.proj3d.line2d_dist``
- ``mpl_toolkits.mplot3d.proj3d.line2d_seg_dist``
- ``mpl_toolkits.mplot3d.proj3d.mod``
- ``mpl_toolkits.mplot3d.proj3d.proj_transform_vec``
- ``mpl_toolkits.mplot3d.proj3d.proj_transform_vec_clip``
- ``mpl_toolkits.mplot3d.proj3d.vec_pad_ones``
- ``mpl_toolkits.mplot3d.proj3d.proj_trans_clip_points``

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

Expand Down Expand Up @@ -944,7 +944,7 @@ instead.
Testing
~~~~~~~

- `matplotlib.testing.decorators.switch_backend` decorator
- ``matplotlib.testing.decorators.switch_backend`` decorator

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

- `.path.get_paths_extents`
- ``path.get_paths_extents``

Use `~.path.get_path_collection_extents` instead.

Expand All @@ -1031,9 +1031,9 @@ Text
~~~~

- ``text.TextWithDash``
- `.Text.is_math_text`
- `.TextPath.is_math_text`
- `.TextPath.text_get_vertices_codes` (As an alternative, construct a new ``TextPath`` object.)
- ``Text.is_math_text``
- ``TextPath.is_math_text``
- ``TextPath.text_get_vertices_codes`` (As an alternative, construct a new ``TextPath`` object.)

Unused attributes
~~~~~~~~~~~~~~~~~
Expand Down
17 changes: 0 additions & 17 deletions doc/api/toolkits/mplot3d.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,25 +79,16 @@ Art3D Utility Functions
:toctree: ../_as_gen
:template: autosummary.rst

art3d.get_colors
art3d.get_dir_vector
art3d.get_patch_verts
art3d.juggle_axes
art3d.line_2d_to_3d
art3d.line_collection_2d_to_3d
art3d.norm_angle
art3d.norm_text_angle
art3d.patch_2d_to_3d
art3d.patch_collection_2d_to_3d
art3d.path_to_3d_segment
art3d.path_to_3d_segment_with_codes
art3d.pathpatch_2d_to_3d
art3d.paths_to_3d_segments
art3d.paths_to_3d_segments_with_codes
art3d.poly_collection_2d_to_3d
art3d.rotate_axes
art3d.text_2d_to_3d
art3d.zalpha

.. _toolkit_mplot3d-projapi:

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

proj3d.inv_transform
proj3d.line2d
proj3d.line2d_dist
proj3d.line2d_seg_dist
proj3d.mod
proj3d.persp_transformation
proj3d.proj_points
proj3d.proj_trans_clip_points
proj3d.proj_trans_points
proj3d.proj_transform
proj3d.proj_transform_clip
proj3d.proj_transform_vec
proj3d.proj_transform_vec_clip
proj3d.rot_x
proj3d.transform
proj3d.vec_pad_ones
proj3d.view_transformation
proj3d.world_transformation
5 changes: 0 additions & 5 deletions lib/mpl_toolkits/axisartist/axis_artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,6 @@ def draw(self, renderer):
renderer.close_group('line2d')


@cbook.deprecated("3.1")
class UnimplementedException(Exception):
pass


class AttributeCopier:
@cbook.deprecated("3.2")
def __init__(self, ref_artist, klass=Artist):
Expand Down
36 changes: 2 additions & 34 deletions lib/mpl_toolkits/axisartist/axislines.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,42 +452,10 @@ def get_gridlines(self, which="major", axis="both"):
return gridlines


@cbook.deprecated("3.1")
class SimpleChainedObjects:
def __init__(self, objects):
self._objects = objects

def __getattr__(self, k):
_a = SimpleChainedObjects([getattr(a, k) for a in self._objects])
return _a

def __call__(self, *args, **kwargs):
for m in self._objects:
m(*args, **kwargs)


class Axes(maxes.Axes):

@cbook.deprecated("3.1")
class AxisDict(dict):
def __init__(self, axes):
self.axes = axes
super().__init__()

def __getitem__(self, k):
if isinstance(k, tuple):
return SimpleChainedObjects(
[dict.__getitem__(self, k1) for k1 in k])
elif isinstance(k, slice):
if k == slice(None):
return SimpleChainedObjects(list(self.values()))
else:
raise ValueError("Unsupported slice")
else:
return dict.__getitem__(self, k)

def __call__(self, *args, **kwargs):
return maxes.Axes.axis(self.axes, *args, **kwargs)
def __call__(self, *args, **kwargs):
return maxes.Axes.axis(self.axes, *args, **kwargs)

def __init__(self, *args, grid_helper=None, **kwargs):
self._axisline_on = True
Expand Down
56 changes: 0 additions & 56 deletions lib/mpl_toolkits/mplot3d/art3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ def _norm_angle(a):
return a


@cbook.deprecated("3.1")
def norm_angle(a):
"""Return the given angle normalized to -180 < *a* <= 180 degrees."""
return _norm_angle(a)


def _norm_text_angle(a):
"""Return the given angle normalized to -90 < *a* <= 90 degrees."""
a = (a + 180) % 180
Expand All @@ -42,12 +36,6 @@ def _norm_text_angle(a):
return a


@cbook.deprecated("3.1")
def norm_text_angle(a):
"""Return the given angle normalized to -90 < *a* <= 90 degrees."""
return _norm_text_angle(a)


def get_dir_vector(zdir):
"""
Return a direction vector.
Expand Down Expand Up @@ -222,12 +210,6 @@ def _path_to_3d_segment(path, zs=0, zdir='z'):
return seg3d


@cbook.deprecated("3.1")
def path_to_3d_segment(path, zs=0, zdir='z'):
"""Convert a path to a 3D segment."""
return _path_to_3d_segment(path, zs=zs, zdir=zdir)


def _paths_to_3d_segments(paths, zs=0, zdir='z'):
"""Convert paths from a collection object to 3D segments."""

Expand All @@ -237,12 +219,6 @@ def _paths_to_3d_segments(paths, zs=0, zdir='z'):
return segs


@cbook.deprecated("3.1")
def paths_to_3d_segments(paths, zs=0, zdir='z'):
"""Convert paths from a collection object to 3D segments."""
return _paths_to_3d_segments(paths, zs=zs, zdir=zdir)


def _path_to_3d_segment_with_codes(path, zs=0, zdir='z'):
"""Convert a path to a 3D segment with path codes."""

Expand All @@ -258,12 +234,6 @@ def _path_to_3d_segment_with_codes(path, zs=0, zdir='z'):
return seg3d, list(codes)


@cbook.deprecated("3.1")
def path_to_3d_segment_with_codes(path, zs=0, zdir='z'):
"""Convert a path to a 3D segment with path codes."""
return _path_to_3d_segment_with_codes(path, zs=zs, zdir=zdir)


def _paths_to_3d_segments_with_codes(paths, zs=0, zdir='z'):
"""
Convert paths from a collection object to 3D segments with path codes.
Expand All @@ -279,14 +249,6 @@ def _paths_to_3d_segments_with_codes(paths, zs=0, zdir='z'):
return list(segments), list(codes)


@cbook.deprecated("3.1")
def paths_to_3d_segments_with_codes(paths, zs=0, zdir='z'):
"""
Convert paths from a collection object to 3D segments with path codes.
"""
return _paths_to_3d_segments_with_codes(paths, zs=zs, zdir=zdir)


class Line3DCollection(LineCollection):
"""
A collection of 3D lines.
Expand Down Expand Up @@ -399,12 +361,6 @@ def _get_patch_verts(patch):
return []


@cbook.deprecated("3.1")
def get_patch_verts(patch):
"""Return a list of vertices for the path of a patch."""
return _get_patch_verts(patch)


def patch_2d_to_3d(patch, z=0, zdir='z'):
"""Convert a Patch to a Patch3D object."""
verts = _get_patch_verts(patch)
Expand Down Expand Up @@ -806,12 +762,6 @@ def _get_colors(c, num):
(num, 4))


@cbook.deprecated("3.1")
def get_colors(c, num):
"""Stretch the color argument to provide the required number *num*."""
return _get_colors(c, num)


def _zalpha(colors, zs):
"""Modify the alphas of the color list according to depth."""
# FIXME: This only works well if the points for *zs* are well-spaced
Expand All @@ -824,9 +774,3 @@ def _zalpha(colors, zs):
sats = 1 - norm(zs) * 0.7
rgba = np.broadcast_to(mcolors.to_rgba_array(colors), (len(zs), 4))
return np.column_stack([rgba[:, :3], rgba[:, 3] * sats])


@cbook.deprecated("3.1")
def zalpha(colors, zs):
"""Modify the alphas of the color list according to depth."""
return _zalpha(colors, zs)
17 changes: 1 addition & 16 deletions lib/mpl_toolkits/mplot3d/axis3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,10 @@
import numpy as np

from matplotlib import (
artist, cbook, lines as mlines, axis as maxis, patches as mpatches,
rcParams)
artist, lines as mlines, axis as maxis, patches as mpatches, rcParams)
from . import art3d, proj3d


@cbook.deprecated("3.1")
def get_flip_min_max(coord, index, mins, maxs):
if coord[index] == mins[index]:
return maxs[index]
else:
return mins[index]


def move_from_center(coord, centers, deltas, axmask=(True, True, True)):
"""
For each coordinate where *axmask* is True, move *coord* away from
Expand Down Expand Up @@ -126,12 +117,6 @@ def init3d(self):
self.label._transform = self.axes.transData
self.offsetText._transform = self.axes.transData

@cbook.deprecated("3.1")
def get_tick_positions(self):
majorLocs = self.major.locator()
majorLabels = self.major.formatter.format_ticks(majorLocs)
return majorLabels, majorLocs

def get_major_ticks(self, numticks=None):
ticks = maxis.XAxis.get_major_ticks(self, numticks)
for t in ticks:
Expand Down
Loading