From e3e93ae3ef600f99d267172eb5c8dd58b021698c Mon Sep 17 00:00:00 2001 From: David Stansby Date: Sun, 16 Aug 2020 15:40:12 +0100 Subject: [PATCH] Remove mpl.colors deprecations for 3.4 --- doc/api/colors_api.rst | 2 -- doc/api/next_api_changes/removals/18201-DS.rst | 5 +++++ .../api_changes_3.2.0/deprecations.rst | 2 +- lib/matplotlib/colors.py | 17 +---------------- lib/matplotlib/tests/test_colors.py | 5 ----- 5 files changed, 7 insertions(+), 24 deletions(-) create mode 100644 doc/api/next_api_changes/removals/18201-DS.rst diff --git a/doc/api/colors_api.rst b/doc/api/colors_api.rst index 692c7d022c03..d0c05aeaef35 100644 --- a/doc/api/colors_api.rst +++ b/doc/api/colors_api.rst @@ -20,7 +20,6 @@ Classes BoundaryNorm Colormap - DivergingNorm LightSource LinearSegmentedColormap ListedColormap @@ -47,5 +46,4 @@ Functions to_rgba_array is_color_like same_color - makeMappingArray get_named_colors_mapping diff --git a/doc/api/next_api_changes/removals/18201-DS.rst b/doc/api/next_api_changes/removals/18201-DS.rst new file mode 100644 index 000000000000..0e079262fb7f --- /dev/null +++ b/doc/api/next_api_changes/removals/18201-DS.rst @@ -0,0 +1,5 @@ +`matplotlib.colors` removals +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- ``makeMappingArray`` has been removed. +- ``DivergingNorm`` has been renamed to `~matplotlib.colors.TwoSlopeNorm`. diff --git a/doc/api/prev_api_changes/api_changes_3.2.0/deprecations.rst b/doc/api/prev_api_changes/api_changes_3.2.0/deprecations.rst index 1c0ae8afafe0..b6e47da29a7b 100644 --- a/doc/api/prev_api_changes/api_changes_3.2.0/deprecations.rst +++ b/doc/api/prev_api_changes/api_changes_3.2.0/deprecations.rst @@ -223,7 +223,7 @@ to a NumPy array with ``np.asarray`` before processing it. Colors ~~~~~~ -The function `matplotlib.colors.makeMappingArray` is not considered part of +The function ``matplotlib.colors.makeMappingArray`` is not considered part of the public API any longer. Thus, it's deprecated. Using a string of single-character colors as a color sequence (e.g. "rgb") is diff --git a/lib/matplotlib/colors.py b/lib/matplotlib/colors.py index 95151c7b9779..6bef54b3ba2f 100644 --- a/lib/matplotlib/colors.py +++ b/lib/matplotlib/colors.py @@ -78,7 +78,7 @@ import matplotlib as mpl import numpy as np -from matplotlib import cbook, docstring, scale +from matplotlib import cbook, scale from ._color_data import BASE_COLORS, TABLEAU_COLORS, CSS4_COLORS, XKCD_COLORS @@ -479,13 +479,6 @@ def _create_lookup_table(N, data, gamma=1.0): return np.clip(lut, 0.0, 1.0) -@cbook.deprecated("3.2", - addendum='This is not considered public API any longer.') -@docstring.copy(_create_lookup_table) -def makeMappingArray(N, data, gamma=1.0): - return _create_lookup_table(N, data, gamma) - - def _warn_if_global_cmap_modified(cmap): if getattr(cmap, '_global', False): cbook.warn_deprecated( @@ -763,9 +756,6 @@ def __init__(self, name, segmentdata, N=256, gamma=1.0): LinearSegmentedColormap.from_list Static method; factory function for generating a smoothly-varying LinearSegmentedColormap. - - makeMappingArray - For information about making a mapping array. """ # True only if all colors in map are identical; needed for contouring. self.monochrome = False @@ -1185,11 +1175,6 @@ def __call__(self, value, clip=None): return result -@cbook.deprecation.deprecated('3.2', alternative='TwoSlopeNorm') -class DivergingNorm(TwoSlopeNorm): - ... - - def _make_norm_from_scale(scale_cls, base_norm_cls=None, *, init=None): """ Decorator for building a `.Normalize` subclass from a `.Scale` subclass. diff --git a/lib/matplotlib/tests/test_colors.py b/lib/matplotlib/tests/test_colors.py index 5e0b2044bcf8..aa0022a8f1ec 100644 --- a/lib/matplotlib/tests/test_colors.py +++ b/lib/matplotlib/tests/test_colors.py @@ -1138,11 +1138,6 @@ def test_hex_shorthand_notation(): assert mcolors.same_color("#123a", "#112233aa") -def test_DivergingNorm_deprecated(): - with pytest.warns(cbook.MatplotlibDeprecationWarning): - norm = mcolors.DivergingNorm(vcenter=0) - - def test_repr_png(): cmap = plt.get_cmap('viridis') png = cmap._repr_png_()