Skip to content

Remove mpl.colors deprecations for 3.4 #18201

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
Aug 16, 2020
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
2 changes: 0 additions & 2 deletions doc/api/colors_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Classes

BoundaryNorm
Colormap
DivergingNorm
LightSource
LinearSegmentedColormap
ListedColormap
Expand All @@ -47,5 +46,4 @@ Functions
to_rgba_array
is_color_like
same_color
makeMappingArray
get_named_colors_mapping
5 changes: 5 additions & 0 deletions doc/api/next_api_changes/removals/18201-DS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
`matplotlib.colors` removals
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- ``makeMappingArray`` has been removed.
- ``DivergingNorm`` has been renamed to `~matplotlib.colors.TwoSlopeNorm`.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 1 addition & 16 deletions lib/matplotlib/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
5 changes: 0 additions & 5 deletions lib/matplotlib/tests/test_colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_()
Expand Down