Skip to content

Remove API deprecated in 3.1 (part 2) #15890

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
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
51 changes: 50 additions & 1 deletion doc/api/next_api_changes/removals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ Classes and methods

- ``sphinxext.plot_directive.plot_directive()``
(use the class ``PlotDirective`` instead)
- ``sphinxext.mathmpl.math_directive()``
(use the class ``MathDirective`` instead)

- ``Artist.aname`` property (no replacement)
- ``Axis.iter_ticks`` (no replacement)
Expand All @@ -71,6 +73,47 @@ Classes and methods

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

- ``dates.seconds()`` (no replacement)
- ``dates.minutes()`` (no replacement)
- ``dates.hours()`` (no replacement)
- ``dates.weeks()`` (no replacement)

- ``font_manager.OSXInstalledFonts()`` (no replacement)

- ``mlab.demean()`` (use ``mlab.detrend_mean()`` instead)
- ``projections.process_projection_requirements()`` (no replacement)
- ``path.get_paths_extents()``
(use ``path.get_path_collection_extents()`` instead)

- ``docstring.Appender`` (no replacement)
- ``docstring.dedent()`` (use `inspect.getdoc` instead)
- ``docstring.copy_dedent()``
(use ``docstring.copy()`` and `inspect.getdoc` instead)

- ``ticker.OldScalarFormatter.pprint_val()`` (no replacement)
- ``ticker.ScalarFormatter.pprint_val()`` (no replacement)
- ``ticker.LogFormatter.pprint_val()`` (no replacement)
- ``ticker.decade_down()`` (no replacement)
- ``ticker.decade_up()`` (no replacement)

- ``scale.LogTransformBase`` (use ``scale.LogTransform`` instead)
- ``scale.InvertedLogTransformBase`` (use ``scale.InvertedLogTransform`` instead)
- ``scale.Log10TransformBase`` (use ``scale.LogTransform`` instead)
- ``scale.InvertedLog10TransformBase`` (use ``scale.InvertedLogTransform`` instead)
- ``scale.Log2Transform`` (use ``scale.LogTransform`` instead)
- ``scale.InvertedLog2Transform`` (use ``scale.InvertedLogTransform`` instead)
- ``scale.NaturalLogTransform`` (use ``scale.LogTransform`` instead)
- ``scale.InvertedNaturalLogTransform`` (use ``scale.InvertedLogTransform`` instead)

- ``spines.Spine.is_frame_like()`` (no replacement)
- ``text.is_math_text()`` (use ``cbook.is_math_text()`` instead)
- ``text.TextWithDash()`` (use ``text.Annotation`` instead)
- ``textpath.TextPath.is_math_text()`` (use ``cbook.is_math_text()`` instead)
- ``textpath.TextPath.text_get_vertices_codes()``
(use ``textpath.text_to_path.get_text_path()`` instead)

- ``widgets.SpanSelector.buttonDown`` property (no replacement)

- ``mplot3d.proj3d.line2d()`` (no replacement)
- ``mplot3d.proj3d.line2d_dist()`` (no replacement)
- ``mplot3d.proj3d.line2d_seg_dist()`` (no replacement)
Expand Down Expand Up @@ -99,7 +142,13 @@ Classes and methods
- ``axisartist.axislines.Axes.AxisDict``
(use ``axis_grid1.mpl_axes.Axes.AxisDict`` instead)

- ``testing.decorators.switch_backend()`` (use ``pytest.mark.backend`` instead)

Arguments
~~~~~~~~~
- ``Axes.text()`` / ``pyplot.text()`` do not support the parameter ``withdash``
anymore. Use ``Axes.annotate()`` and ``pyplot.annotate()`` instead.
anymore. Use ``Axes.annotate()`` and ``pyplot.annotate()`` instead.

Others
~~~~~~
- The math text command ``\stackrel`` is removed. Use ``\genfrac`` instead.
35 changes: 1 addition & 34 deletions lib/matplotlib/dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@
'SecondLocator', 'MicrosecondLocator',
'rrule', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU',
'YEARLY', 'MONTHLY', 'WEEKLY', 'DAILY',
'HOURLY', 'MINUTELY', 'SECONDLY', 'MICROSECONDLY', 'relativedelta',
'seconds', 'minutes', 'hours', 'weeks')
'HOURLY', 'MINUTELY', 'SECONDLY', 'MICROSECONDLY', 'relativedelta')


_log = logging.getLogger(__name__)
Expand Down Expand Up @@ -1836,38 +1835,6 @@ def date_ticker_factory(span, tz=None, numticks=5):
return locator, formatter


@cbook.deprecated("3.1")
def seconds(s):
"""
Return seconds as days.
"""
return s / SEC_PER_DAY


@cbook.deprecated("3.1")
def minutes(m):
"""
Return minutes as days.
"""
return m / MINUTES_PER_DAY


@cbook.deprecated("3.1")
def hours(h):
"""
Return hours as days.
"""
return h / HOURS_PER_DAY


@cbook.deprecated("3.1")
def weeks(w):
"""
Return weeks as days.
"""
return w * DAYS_PER_WEEK


class DateConverter(units.ConversionInterface):
"""
Converter for `datetime.date` and `datetime.datetime` data, or for
Expand Down
48 changes: 0 additions & 48 deletions lib/matplotlib/docstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,43 +59,6 @@ def from_params(cls, params):
return result


@cbook.deprecated("3.1")
class Appender:
r"""
A function decorator that will append an addendum to the docstring
of the target function.

This decorator should be robust even if func.__doc__ is None
(for example, if -OO was passed to the interpreter).

Usage: construct a docstring.Appender with a string to be joined to
the original docstring. An optional 'join' parameter may be supplied
which will be used to join the docstring and addendum. e.g.

add_copyright = Appender("Copyright (c) 2009", join='\n')

@add_copyright
def my_dog(has='fleas'):
"This docstring will have a copyright below"
pass
"""
def __init__(self, addendum, join=''):
self.addendum = addendum
self.join = join

def __call__(self, func):
docitems = [func.__doc__, self.addendum]
func.__doc__ = func.__doc__ and self.join.join(docitems)
return func


@cbook.deprecated("3.1", alternative="inspect.getdoc()")
def dedent(func):
"Dedent a docstring (if present)"
func.__doc__ = func.__doc__ and cbook.dedent(func.__doc__)
return func


def copy(source):
"Copy a docstring from another source function (if present)"
def do_copy(target):
Expand All @@ -114,14 +77,3 @@ def dedent_interpd(func):
"""Dedent *func*'s docstring, then interpolate it with ``interpd``."""
func.__doc__ = inspect.getdoc(func)
return interpd(func)


@cbook.deprecated("3.1", alternative="docstring.copy() and cbook.dedent()")
def copy_dedent(source):
"""A decorator that will copy the docstring from the source and
then dedent it"""
# note the following is ugly because "Python is not a functional
# language" - GVR. Perhaps one day, functools.compose will exist.
# or perhaps not.
# http://mail.python.org/pipermail/patches/2007-February/021687.html
return lambda target: dedent(copy(source)(target))
1 change: 0 additions & 1 deletion lib/matplotlib/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
from matplotlib.gridspec import GridSpec
import matplotlib.legend as mlegend
from matplotlib.patches import Rectangle
from matplotlib.projections import process_projection_requirements
from matplotlib.text import Text
from matplotlib.transforms import (Affine2D, Bbox, BboxTransformTo,
TransformedBbox)
Expand Down
10 changes: 0 additions & 10 deletions lib/matplotlib/font_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,16 +253,6 @@ def win32InstalledFonts(directory=None, fontext='ttf'):
return [str(path) for path in items if path.suffix.lower() in fontext]


@cbook.deprecated("3.1")
def OSXInstalledFonts(directories=None, fontext='ttf'):
"""Get list of font files on OS X."""
if directories is None:
directories = OSXFontDirectories
return [path
for directory in directories
for path in list_fonts(directory, get_fontext_synonyms(fontext))]


@lru_cache()
def _call_fc_list():
"""Cache and list the font filenames known to `fc-list`.
Expand Down
10 changes: 0 additions & 10 deletions lib/matplotlib/mathtext.py
Original file line number Diff line number Diff line change
Expand Up @@ -3169,16 +3169,6 @@ def dfrac(self, s, loc, toks):
return self._genfrac('', '', thickness,
self._math_style_dict['displaystyle'], num, den)

@cbook.deprecated("3.1", obj_type="mathtext command",
alternative=r"\genfrac")
def stackrel(self, s, loc, toks):
assert len(toks) == 1
assert len(toks[0]) == 2
num, den = toks[0]

return self._genfrac('', '', 0.0,
self._math_style_dict['textstyle'], num, den)

def binom(self, s, loc, toks):
assert len(toks) == 1
assert len(toks[0]) == 2
Expand Down
22 changes: 0 additions & 22 deletions lib/matplotlib/mlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,28 +191,6 @@ def detrend(x, key=None, axis=None):
f"'constant', 'mean', 'linear', or a function")


@cbook.deprecated("3.1", alternative="detrend_mean")
def demean(x, axis=0):
'''
Return x minus its mean along the specified axis.

Parameters
----------
x : array or sequence
Array or sequence containing the data
Can have any dimensionality

axis : int
The axis along which to take the mean. See numpy.mean for a
description of this argument.

See Also
--------
detrend_mean : Same as `demean` except for the default *axis*.
'''
return detrend_mean(x, axis=axis)


def detrend_mean(x, axis=None):
'''
Return x minus the mean(x).
Expand Down
20 changes: 0 additions & 20 deletions lib/matplotlib/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -989,23 +989,3 @@ def get_path_collection_extents(
return Bbox.from_extents(*_path.get_path_collection_extents(
master_transform, paths, np.atleast_3d(transforms),
offsets, offset_transform))


@cbook.deprecated("3.1", alternative="get_paths_collection_extents")
def get_paths_extents(paths, transforms=[]):
"""
Given a sequence of :class:`Path` objects and optional
:class:`~matplotlib.transforms.Transform` objects, returns the
bounding box that encapsulates all of them.

*paths* is a sequence of :class:`Path` instances.

*transforms* is an optional sequence of
:class:`~matplotlib.transforms.Affine2D` instances to apply to
each path.
"""
from .transforms import Bbox, Affine2D
if len(paths) == 0:
raise ValueError("No paths provided")
return Bbox.from_extents(*_path.get_path_collection_extents(
Affine2D(), paths, transforms, [], Affine2D()))
7 changes: 1 addition & 6 deletions lib/matplotlib/projections/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .. import axes, docstring, cbook
from .. import axes, docstring
from .geo import AitoffAxes, HammerAxes, LambertAxes, MollweideAxes
from .polar import PolarAxes
from mpl_toolkits.mplot3d import Axes3D
Expand Down Expand Up @@ -56,10 +56,5 @@ def get_projection_class(projection=None):
raise ValueError("Unknown projection %r" % projection)


@cbook.deprecated("3.1")
def process_projection_requirements(figure, *args, **kwargs):
return figure._process_projection_requirements(*args, **kwargs)


get_projection_names = projection_registry.get_projection_names
docstring.interpd.update(projection_names=get_projection_names())
4 changes: 2 additions & 2 deletions lib/matplotlib/pylab.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@
## We are still importing too many things from mlab; more cleanup is needed.

from matplotlib.mlab import (
demean, detrend, detrend_linear, detrend_mean, detrend_none,
window_hanning, window_none)
detrend, detrend_linear, detrend_mean, detrend_none, window_hanning,
window_none)

from matplotlib import cbook, mlab, pyplot as plt
from matplotlib.pyplot import *
Expand Down
Loading