Skip to content

Commit 20b8787

Browse files
committed
Remove more API deprecated in 3.1
1 parent 2c5c351 commit 20b8787

File tree

8 files changed

+17
-217
lines changed

8 files changed

+17
-217
lines changed

doc/api/next_api_changes/removals.rst

+16
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ Classes and methods
5151

5252
- ``sphinxext.plot_directive.plot_directive()``
5353
(use the class ``PlotDirective`` instead)
54+
- ``sphinxext.mathmpl.math_directive()``
55+
(use the class ``MathDirective`` instead)
5456

5557
- ``Artist.aname`` property (no replacement)
5658
- ``Axis.iter_ticks`` (no replacement)
@@ -69,6 +71,20 @@ Classes and methods
6971
- ``colorbar.ColorbarBase.set_clim`` (use ``ScalarMappable.set_clim`` instead)
7072
- ``colorbar.ColorbarBase.set_norm`` (use ``ScalarMappable.set_norm`` instead)
7173

74+
- ``dates.seconds()`` (no replacement)
75+
- ``dates.minutes()`` (no replacement)
76+
- ``dates.hours()`` (no replacement)
77+
- ``dates.weeks()`` (no replacement)
78+
79+
- ``font_manager.OSXInstalledFonts()`` (no replacement)
80+
81+
- ``mlab.demean()`` (use ``mlab.detrend_mean()`` instead)
82+
83+
- ``projections.process_projection_requirements()`` (no replacement)
84+
85+
- ``path.get_paths_extents()``
86+
(use ``path.get_path_collection_extents()`` instead)
87+
7288
- ``text.TextWithDash`` (use ``text.Annotation`` instead)
7389

7490
- ``mplot3d.proj3d.line2d()`` (no replacement)

lib/matplotlib/dates.py

-33
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@
163163
'rrule', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU',
164164
'YEARLY', 'MONTHLY', 'WEEKLY', 'DAILY',
165165
'HOURLY', 'MINUTELY', 'SECONDLY', 'MICROSECONDLY', 'relativedelta',
166-
'seconds', 'minutes', 'hours', 'weeks',
167166
'DateConverter', 'ConciseDateConverter')
168167

169168

@@ -1837,38 +1836,6 @@ def date_ticker_factory(span, tz=None, numticks=5):
18371836
return locator, formatter
18381837

18391838

1840-
@cbook.deprecated("3.1")
1841-
def seconds(s):
1842-
"""
1843-
Return seconds as days.
1844-
"""
1845-
return s / SEC_PER_DAY
1846-
1847-
1848-
@cbook.deprecated("3.1")
1849-
def minutes(m):
1850-
"""
1851-
Return minutes as days.
1852-
"""
1853-
return m / MINUTES_PER_DAY
1854-
1855-
1856-
@cbook.deprecated("3.1")
1857-
def hours(h):
1858-
"""
1859-
Return hours as days.
1860-
"""
1861-
return h / HOURS_PER_DAY
1862-
1863-
1864-
@cbook.deprecated("3.1")
1865-
def weeks(w):
1866-
"""
1867-
Return weeks as days.
1868-
"""
1869-
return w * DAYS_PER_WEEK
1870-
1871-
18721839
class DateConverter(units.ConversionInterface):
18731840
"""
18741841
Converter for `datetime.date` and `datetime.datetime` data, or for

lib/matplotlib/font_manager.py

-10
Original file line numberDiff line numberDiff line change
@@ -253,16 +253,6 @@ def win32InstalledFonts(directory=None, fontext='ttf'):
253253
return [str(path) for path in items if path.suffix.lower() in fontext]
254254

255255

256-
@cbook.deprecated("3.1")
257-
def OSXInstalledFonts(directories=None, fontext='ttf'):
258-
"""Get list of font files on OS X."""
259-
if directories is None:
260-
directories = OSXFontDirectories
261-
return [path
262-
for directory in directories
263-
for path in list_fonts(directory, get_fontext_synonyms(fontext))]
264-
265-
266256
@lru_cache()
267257
def _call_fc_list():
268258
"""Cache and list the font filenames known to `fc-list`.

lib/matplotlib/mlab.py

-22
Original file line numberDiff line numberDiff line change
@@ -191,28 +191,6 @@ def detrend(x, key=None, axis=None):
191191
f"'constant', 'mean', 'linear', or a function")
192192

193193

194-
@cbook.deprecated("3.1", alternative="detrend_mean")
195-
def demean(x, axis=0):
196-
"""
197-
Return x minus its mean along the specified axis.
198-
199-
Parameters
200-
----------
201-
x : array or sequence
202-
Array or sequence containing the data
203-
Can have any dimensionality
204-
205-
axis : int
206-
The axis along which to take the mean. See numpy.mean for a
207-
description of this argument.
208-
209-
See Also
210-
--------
211-
detrend_mean : Same as `demean` except for the default *axis*.
212-
"""
213-
return detrend_mean(x, axis=axis)
214-
215-
216194
def detrend_mean(x, axis=None):
217195
"""
218196
Return x minus the mean(x).

lib/matplotlib/path.py

-20
Original file line numberDiff line numberDiff line change
@@ -990,23 +990,3 @@ def get_path_collection_extents(
990990
return Bbox.from_extents(*_path.get_path_collection_extents(
991991
master_transform, paths, np.atleast_3d(transforms),
992992
offsets, offset_transform))
993-
994-
995-
@cbook.deprecated("3.1", alternative="get_paths_collection_extents")
996-
def get_paths_extents(paths, transforms=[]):
997-
"""
998-
Given a sequence of :class:`Path` objects and optional
999-
:class:`~matplotlib.transforms.Transform` objects, returns the
1000-
bounding box that encapsulates all of them.
1001-
1002-
*paths* is a sequence of :class:`Path` instances.
1003-
1004-
*transforms* is an optional sequence of
1005-
:class:`~matplotlib.transforms.Affine2D` instances to apply to
1006-
each path.
1007-
"""
1008-
from .transforms import Bbox, Affine2D
1009-
if len(paths) == 0:
1010-
raise ValueError("No paths provided")
1011-
return Bbox.from_extents(*_path.get_path_collection_extents(
1012-
Affine2D(), paths, transforms, [], Affine2D()))

lib/matplotlib/projections/__init__.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .. import axes, docstring, cbook
1+
from .. import axes, docstring
22
from .geo import AitoffAxes, HammerAxes, LambertAxes, MollweideAxes
33
from .polar import PolarAxes
44
from mpl_toolkits.mplot3d import Axes3D
@@ -56,10 +56,5 @@ def get_projection_class(projection=None):
5656
raise ValueError("Unknown projection %r" % projection)
5757

5858

59-
@cbook.deprecated("3.1")
60-
def process_projection_requirements(figure, *args, **kwargs):
61-
return figure._process_projection_requirements(*args, **kwargs)
62-
63-
6459
get_projection_names = projection_registry.get_projection_names
6560
docstring.interpd.update(projection_names=get_projection_names())

lib/matplotlib/sphinxext/mathmpl.py

-10
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,6 @@ def math_role(role, rawtext, text, lineno, inliner,
3131
math_role.options = {'fontset': fontset_choice}
3232

3333

34-
@cbook.deprecated("3.1", alternative="MathDirective")
35-
def math_directive(name, arguments, options, content, lineno,
36-
content_offset, block_text, state, state_machine):
37-
latex = ''.join(content)
38-
node = latex_math(block_text)
39-
node['latex'] = latex
40-
node['fontset'] = options.get('fontset', 'cm')
41-
return [node]
42-
43-
4434
class MathDirective(Directive):
4535
has_content = True
4636
required_arguments = 0

lib/matplotlib/tests/test_mlab.py

-116
Original file line numberDiff line numberDiff line change
@@ -624,34 +624,6 @@ def test_detrend_mean_1D_base_slope_off_list_axis0(self):
624624
res = mlab.detrend_mean(input.tolist(), axis=0)
625625
assert_allclose(res, targ, atol=1e-08)
626626

627-
def test_demean_0D_off(self):
628-
input = 5.5
629-
targ = 0.
630-
with pytest.warns(MatplotlibDeprecationWarning):
631-
res = mlab.demean(input, axis=None)
632-
assert_almost_equal(res, targ)
633-
634-
def test_demean_1D_base_slope_off(self):
635-
input = self.sig_base + self.sig_slope + self.sig_off
636-
targ = self.sig_base + self.sig_slope_mean
637-
with pytest.warns(MatplotlibDeprecationWarning):
638-
res = mlab.demean(input)
639-
assert_allclose(res, targ, atol=1e-08)
640-
641-
def test_demean_1D_base_slope_off_axis0(self):
642-
input = self.sig_base + self.sig_slope + self.sig_off
643-
targ = self.sig_base + self.sig_slope_mean
644-
with pytest.warns(MatplotlibDeprecationWarning):
645-
res = mlab.demean(input, axis=0)
646-
assert_allclose(res, targ, atol=1e-08)
647-
648-
def test_demean_1D_base_slope_off_list(self):
649-
input = self.sig_base + self.sig_slope + self.sig_off
650-
targ = self.sig_base + self.sig_slope_mean
651-
with pytest.warns(MatplotlibDeprecationWarning):
652-
res = mlab.demean(input.tolist())
653-
assert_allclose(res, targ, atol=1e-08)
654-
655627
def test_detrend_mean_2D_default(self):
656628
arri = [self.sig_off,
657629
self.sig_base + self.sig_off]
@@ -805,82 +777,6 @@ def test_detrend_detrend_mean_2D_axis0(self):
805777
assert_allclose(res, targ,
806778
atol=1e-08)
807779

808-
def test_demean_2D_default(self):
809-
arri = [self.sig_base,
810-
self.sig_base + self.sig_off,
811-
self.sig_base + self.sig_slope,
812-
self.sig_base + self.sig_off + self.sig_slope]
813-
arrt = [self.sig_base,
814-
self.sig_base,
815-
self.sig_base + self.sig_slope_mean,
816-
self.sig_base + self.sig_slope_mean]
817-
input = np.vstack(arri).T
818-
targ = np.vstack(arrt).T
819-
with pytest.warns(MatplotlibDeprecationWarning):
820-
res = mlab.demean(input)
821-
assert_allclose(res, targ,
822-
atol=1e-08)
823-
824-
def test_demean_2D_none(self):
825-
arri = [self.sig_off,
826-
self.sig_base + self.sig_off]
827-
arrt = [self.sig_zeros,
828-
self.sig_base]
829-
input = np.vstack(arri)
830-
targ = np.vstack(arrt)
831-
with pytest.warns(MatplotlibDeprecationWarning):
832-
res = mlab.demean(input, axis=None)
833-
assert_allclose(res, targ,
834-
atol=1e-08)
835-
836-
def test_demean_2D_axis0(self):
837-
arri = [self.sig_base,
838-
self.sig_base + self.sig_off,
839-
self.sig_base + self.sig_slope,
840-
self.sig_base + self.sig_off + self.sig_slope]
841-
arrt = [self.sig_base,
842-
self.sig_base,
843-
self.sig_base + self.sig_slope_mean,
844-
self.sig_base + self.sig_slope_mean]
845-
input = np.vstack(arri).T
846-
targ = np.vstack(arrt).T
847-
with pytest.warns(MatplotlibDeprecationWarning):
848-
res = mlab.demean(input, axis=0)
849-
assert_allclose(res, targ,
850-
atol=1e-08)
851-
852-
def test_demean_2D_axis1(self):
853-
arri = [self.sig_base,
854-
self.sig_base + self.sig_off,
855-
self.sig_base + self.sig_slope,
856-
self.sig_base + self.sig_off + self.sig_slope]
857-
arrt = [self.sig_base,
858-
self.sig_base,
859-
self.sig_base + self.sig_slope_mean,
860-
self.sig_base + self.sig_slope_mean]
861-
input = np.vstack(arri)
862-
targ = np.vstack(arrt)
863-
with pytest.warns(MatplotlibDeprecationWarning):
864-
res = mlab.demean(input, axis=1)
865-
assert_allclose(res, targ,
866-
atol=1e-08)
867-
868-
def test_demean_2D_axism1(self):
869-
arri = [self.sig_base,
870-
self.sig_base + self.sig_off,
871-
self.sig_base + self.sig_slope,
872-
self.sig_base + self.sig_off + self.sig_slope]
873-
arrt = [self.sig_base,
874-
self.sig_base,
875-
self.sig_base + self.sig_slope_mean,
876-
self.sig_base + self.sig_slope_mean]
877-
input = np.vstack(arri)
878-
targ = np.vstack(arrt)
879-
with pytest.warns(MatplotlibDeprecationWarning):
880-
res = mlab.demean(input, axis=-1)
881-
assert_allclose(res, targ,
882-
atol=1e-08)
883-
884780
def test_detrend_bad_key_str_ValueError(self):
885781
input = self.sig_slope[np.newaxis]
886782
with pytest.raises(ValueError):
@@ -911,12 +807,6 @@ def test_detrend_1D_d1_ValueError(self):
911807
with pytest.raises(ValueError):
912808
mlab.detrend(input, axis=1)
913809

914-
def test_demean_1D_d1_ValueError(self):
915-
input = self.sig_slope
916-
with pytest.raises(ValueError), \
917-
pytest.warns(MatplotlibDeprecationWarning):
918-
mlab.demean(input, axis=1)
919-
920810
def test_detrend_mean_2D_d2_ValueError(self):
921811
input = self.sig_slope[np.newaxis]
922812
with pytest.raises(ValueError):
@@ -927,12 +817,6 @@ def test_detrend_2D_d2_ValueError(self):
927817
with pytest.raises(ValueError):
928818
mlab.detrend(input, axis=2)
929819

930-
def test_demean_2D_d2_ValueError(self):
931-
input = self.sig_slope[np.newaxis]
932-
with pytest.raises(ValueError), \
933-
pytest.warns(MatplotlibDeprecationWarning):
934-
mlab.demean(input, axis=2)
935-
936820
def test_detrend_linear_0D_zeros(self):
937821
input = 0.
938822
targ = 0.

0 commit comments

Comments
 (0)