diff --git a/doc/api/next_api_changes/removals.rst b/doc/api/next_api_changes/removals.rst index 8c41ada50790..541d338a92f8 100644 --- a/doc/api/next_api_changes/removals.rst +++ b/doc/api/next_api_changes/removals.rst @@ -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) @@ -69,6 +71,20 @@ Classes and methods - ``colorbar.ColorbarBase.set_clim`` (use ``ScalarMappable.set_clim`` instead) - ``colorbar.ColorbarBase.set_norm`` (use ``ScalarMappable.set_norm`` 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) + - ``text.TextWithDash`` (use ``text.Annotation`` instead) - ``mplot3d.proj3d.line2d()`` (no replacement) diff --git a/lib/matplotlib/dates.py b/lib/matplotlib/dates.py index 32de2a7839a2..c9092a09ce9c 100644 --- a/lib/matplotlib/dates.py +++ b/lib/matplotlib/dates.py @@ -163,7 +163,6 @@ 'rrule', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU', 'YEARLY', 'MONTHLY', 'WEEKLY', 'DAILY', 'HOURLY', 'MINUTELY', 'SECONDLY', 'MICROSECONDLY', 'relativedelta', - 'seconds', 'minutes', 'hours', 'weeks', 'DateConverter', 'ConciseDateConverter') @@ -1837,38 +1836,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 diff --git a/lib/matplotlib/font_manager.py b/lib/matplotlib/font_manager.py index 5033fe550592..a9b20f043866 100644 --- a/lib/matplotlib/font_manager.py +++ b/lib/matplotlib/font_manager.py @@ -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`. diff --git a/lib/matplotlib/mlab.py b/lib/matplotlib/mlab.py index 7c1fb194f7de..be69d1764b93 100644 --- a/lib/matplotlib/mlab.py +++ b/lib/matplotlib/mlab.py @@ -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). diff --git a/lib/matplotlib/path.py b/lib/matplotlib/path.py index 6068961a315f..be4bea6bb932 100644 --- a/lib/matplotlib/path.py +++ b/lib/matplotlib/path.py @@ -990,23 +990,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())) diff --git a/lib/matplotlib/projections/__init__.py b/lib/matplotlib/projections/__init__.py index c13c16972e91..8f854b47d744 100644 --- a/lib/matplotlib/projections/__init__.py +++ b/lib/matplotlib/projections/__init__.py @@ -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 @@ -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()) diff --git a/lib/matplotlib/pylab.py b/lib/matplotlib/pylab.py index 63ffa3e71603..3f93c753b80a 100644 --- a/lib/matplotlib/pylab.py +++ b/lib/matplotlib/pylab.py @@ -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 * diff --git a/lib/matplotlib/sphinxext/mathmpl.py b/lib/matplotlib/sphinxext/mathmpl.py index 4ba446e4eff8..6c3b1c1087ab 100644 --- a/lib/matplotlib/sphinxext/mathmpl.py +++ b/lib/matplotlib/sphinxext/mathmpl.py @@ -31,16 +31,6 @@ def math_role(role, rawtext, text, lineno, inliner, math_role.options = {'fontset': fontset_choice} -@cbook.deprecated("3.1", alternative="MathDirective") -def math_directive(name, arguments, options, content, lineno, - content_offset, block_text, state, state_machine): - latex = ''.join(content) - node = latex_math(block_text) - node['latex'] = latex - node['fontset'] = options.get('fontset', 'cm') - return [node] - - class MathDirective(Directive): has_content = True required_arguments = 0 diff --git a/lib/matplotlib/tests/test_mlab.py b/lib/matplotlib/tests/test_mlab.py index 86be071c2a4f..e904bc99cb4b 100644 --- a/lib/matplotlib/tests/test_mlab.py +++ b/lib/matplotlib/tests/test_mlab.py @@ -624,34 +624,6 @@ def test_detrend_mean_1D_base_slope_off_list_axis0(self): res = mlab.detrend_mean(input.tolist(), axis=0) assert_allclose(res, targ, atol=1e-08) - def test_demean_0D_off(self): - input = 5.5 - targ = 0. - with pytest.warns(MatplotlibDeprecationWarning): - res = mlab.demean(input, axis=None) - assert_almost_equal(res, targ) - - def test_demean_1D_base_slope_off(self): - input = self.sig_base + self.sig_slope + self.sig_off - targ = self.sig_base + self.sig_slope_mean - with pytest.warns(MatplotlibDeprecationWarning): - res = mlab.demean(input) - assert_allclose(res, targ, atol=1e-08) - - def test_demean_1D_base_slope_off_axis0(self): - input = self.sig_base + self.sig_slope + self.sig_off - targ = self.sig_base + self.sig_slope_mean - with pytest.warns(MatplotlibDeprecationWarning): - res = mlab.demean(input, axis=0) - assert_allclose(res, targ, atol=1e-08) - - def test_demean_1D_base_slope_off_list(self): - input = self.sig_base + self.sig_slope + self.sig_off - targ = self.sig_base + self.sig_slope_mean - with pytest.warns(MatplotlibDeprecationWarning): - res = mlab.demean(input.tolist()) - assert_allclose(res, targ, atol=1e-08) - def test_detrend_mean_2D_default(self): arri = [self.sig_off, self.sig_base + self.sig_off] @@ -805,82 +777,6 @@ def test_detrend_detrend_mean_2D_axis0(self): assert_allclose(res, targ, atol=1e-08) - def test_demean_2D_default(self): - arri = [self.sig_base, - self.sig_base + self.sig_off, - self.sig_base + self.sig_slope, - self.sig_base + self.sig_off + self.sig_slope] - arrt = [self.sig_base, - self.sig_base, - self.sig_base + self.sig_slope_mean, - self.sig_base + self.sig_slope_mean] - input = np.vstack(arri).T - targ = np.vstack(arrt).T - with pytest.warns(MatplotlibDeprecationWarning): - res = mlab.demean(input) - assert_allclose(res, targ, - atol=1e-08) - - def test_demean_2D_none(self): - arri = [self.sig_off, - self.sig_base + self.sig_off] - arrt = [self.sig_zeros, - self.sig_base] - input = np.vstack(arri) - targ = np.vstack(arrt) - with pytest.warns(MatplotlibDeprecationWarning): - res = mlab.demean(input, axis=None) - assert_allclose(res, targ, - atol=1e-08) - - def test_demean_2D_axis0(self): - arri = [self.sig_base, - self.sig_base + self.sig_off, - self.sig_base + self.sig_slope, - self.sig_base + self.sig_off + self.sig_slope] - arrt = [self.sig_base, - self.sig_base, - self.sig_base + self.sig_slope_mean, - self.sig_base + self.sig_slope_mean] - input = np.vstack(arri).T - targ = np.vstack(arrt).T - with pytest.warns(MatplotlibDeprecationWarning): - res = mlab.demean(input, axis=0) - assert_allclose(res, targ, - atol=1e-08) - - def test_demean_2D_axis1(self): - arri = [self.sig_base, - self.sig_base + self.sig_off, - self.sig_base + self.sig_slope, - self.sig_base + self.sig_off + self.sig_slope] - arrt = [self.sig_base, - self.sig_base, - self.sig_base + self.sig_slope_mean, - self.sig_base + self.sig_slope_mean] - input = np.vstack(arri) - targ = np.vstack(arrt) - with pytest.warns(MatplotlibDeprecationWarning): - res = mlab.demean(input, axis=1) - assert_allclose(res, targ, - atol=1e-08) - - def test_demean_2D_axism1(self): - arri = [self.sig_base, - self.sig_base + self.sig_off, - self.sig_base + self.sig_slope, - self.sig_base + self.sig_off + self.sig_slope] - arrt = [self.sig_base, - self.sig_base, - self.sig_base + self.sig_slope_mean, - self.sig_base + self.sig_slope_mean] - input = np.vstack(arri) - targ = np.vstack(arrt) - with pytest.warns(MatplotlibDeprecationWarning): - res = mlab.demean(input, axis=-1) - assert_allclose(res, targ, - atol=1e-08) - def test_detrend_bad_key_str_ValueError(self): input = self.sig_slope[np.newaxis] with pytest.raises(ValueError): @@ -911,12 +807,6 @@ def test_detrend_1D_d1_ValueError(self): with pytest.raises(ValueError): mlab.detrend(input, axis=1) - def test_demean_1D_d1_ValueError(self): - input = self.sig_slope - with pytest.raises(ValueError), \ - pytest.warns(MatplotlibDeprecationWarning): - mlab.demean(input, axis=1) - def test_detrend_mean_2D_d2_ValueError(self): input = self.sig_slope[np.newaxis] with pytest.raises(ValueError): @@ -927,12 +817,6 @@ def test_detrend_2D_d2_ValueError(self): with pytest.raises(ValueError): mlab.detrend(input, axis=2) - def test_demean_2D_d2_ValueError(self): - input = self.sig_slope[np.newaxis] - with pytest.raises(ValueError), \ - pytest.warns(MatplotlibDeprecationWarning): - mlab.demean(input, axis=2) - def test_detrend_linear_0D_zeros(self): input = 0. targ = 0.