Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fa32d12

Browse filesBrowse files
committed
Deprecate public use of makeMappingArray
1 parent 65e53ed commit fa32d12
Copy full SHA for fa32d12

File tree

Expand file treeCollapse file tree

3 files changed

+20
-7
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+20
-7
lines changed
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Deprecations
2+
````````````
3+
4+
The function `matplotlib.colors.makeMappingArray` is not considered part of
5+
the public API any longer. Thus, it's deprecated.

‎lib/matplotlib/colors.py

Copy file name to clipboardExpand all lines: lib/matplotlib/colors.py
+13-5Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565

6666
import numpy as np
6767
import matplotlib.cbook as cbook
68+
from matplotlib import docstring
6869
from ._color_data import BASE_COLORS, TABLEAU_COLORS, CSS4_COLORS, XKCD_COLORS
6970

7071

@@ -354,7 +355,7 @@ class ColorConverter(object):
354355
### End of backwards-compatible color-conversion API
355356

356357

357-
def makeMappingArray(N, data, gamma=1.0):
358+
def _create_lookup_table(N, data, gamma=1.0):
358359
r"""Create an *N* -element 1-d lookup table.
359360
360361
This assumes a mapping :math:`f : [0, 1] \rightarrow [0, 1]`. The returned
@@ -452,6 +453,13 @@ def makeMappingArray(N, data, gamma=1.0):
452453
return np.clip(lut, 0.0, 1.0)
453454

454455

456+
@cbook.deprecated("3.2",
457+
addendum='This is not considered public API any longer.')
458+
@docstring.copy(_create_lookup_table)
459+
def makeMappingArray(N, data, gamma=1.0):
460+
return _create_lookup_table(N, data, gamma)
461+
462+
455463
class Colormap(object):
456464
"""
457465
Baseclass for all scalar to RGBA mappings.
@@ -721,14 +729,14 @@ def __init__(self, name, segmentdata, N=256, gamma=1.0):
721729

722730
def _init(self):
723731
self._lut = np.ones((self.N + 3, 4), float)
724-
self._lut[:-3, 0] = makeMappingArray(
732+
self._lut[:-3, 0] = _create_lookup_table(
725733
self.N, self._segmentdata['red'], self._gamma)
726-
self._lut[:-3, 1] = makeMappingArray(
734+
self._lut[:-3, 1] = _create_lookup_table(
727735
self.N, self._segmentdata['green'], self._gamma)
728-
self._lut[:-3, 2] = makeMappingArray(
736+
self._lut[:-3, 2] = _create_lookup_table(
729737
self.N, self._segmentdata['blue'], self._gamma)
730738
if 'alpha' in self._segmentdata:
731-
self._lut[:-3, 3] = makeMappingArray(
739+
self._lut[:-3, 3] = _create_lookup_table(
732740
self.N, self._segmentdata['alpha'], 1)
733741
self._isinit = True
734742
self._set_extremes()

‎lib/matplotlib/tests/test_colors.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_colors.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
(2, [1, 0]),
2222
(1, [0]),
2323
])
24-
def test_makeMappingArray(N, result):
24+
def test_create_lookup_table(N, result):
2525
data = [(0.0, 1.0, 1.0), (0.5, 0.2, 0.2), (1.0, 0.0, 0.0)]
26-
assert_array_almost_equal(mcolors.makeMappingArray(N, data), result)
26+
assert_array_almost_equal(mcolors._create_lookup_table(N, data), result)
2727

2828

2929
def test_resample():

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.