|
65 | 65 |
|
66 | 66 | import numpy as np
|
67 | 67 | import matplotlib.cbook as cbook
|
| 68 | +from matplotlib import docstring |
68 | 69 | from ._color_data import BASE_COLORS, TABLEAU_COLORS, CSS4_COLORS, XKCD_COLORS
|
69 | 70 |
|
70 | 71 |
|
@@ -354,7 +355,7 @@ class ColorConverter(object):
|
354 | 355 | ### End of backwards-compatible color-conversion API
|
355 | 356 |
|
356 | 357 |
|
357 |
| -def makeMappingArray(N, data, gamma=1.0): |
| 358 | +def _create_lookup_table(N, data, gamma=1.0): |
358 | 359 | r"""Create an *N* -element 1-d lookup table.
|
359 | 360 |
|
360 | 361 | This assumes a mapping :math:`f : [0, 1] \rightarrow [0, 1]`. The returned
|
@@ -452,6 +453,13 @@ def makeMappingArray(N, data, gamma=1.0):
|
452 | 453 | return np.clip(lut, 0.0, 1.0)
|
453 | 454 |
|
454 | 455 |
|
| 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 | + |
455 | 463 | class Colormap(object):
|
456 | 464 | """
|
457 | 465 | Baseclass for all scalar to RGBA mappings.
|
@@ -721,14 +729,14 @@ def __init__(self, name, segmentdata, N=256, gamma=1.0):
|
721 | 729 |
|
722 | 730 | def _init(self):
|
723 | 731 | self._lut = np.ones((self.N + 3, 4), float)
|
724 |
| - self._lut[:-3, 0] = makeMappingArray( |
| 732 | + self._lut[:-3, 0] = _create_lookup_table( |
725 | 733 | self.N, self._segmentdata['red'], self._gamma)
|
726 |
| - self._lut[:-3, 1] = makeMappingArray( |
| 734 | + self._lut[:-3, 1] = _create_lookup_table( |
727 | 735 | self.N, self._segmentdata['green'], self._gamma)
|
728 |
| - self._lut[:-3, 2] = makeMappingArray( |
| 736 | + self._lut[:-3, 2] = _create_lookup_table( |
729 | 737 | self.N, self._segmentdata['blue'], self._gamma)
|
730 | 738 | if 'alpha' in self._segmentdata:
|
731 |
| - self._lut[:-3, 3] = makeMappingArray( |
| 739 | + self._lut[:-3, 3] = _create_lookup_table( |
732 | 740 | self.N, self._segmentdata['alpha'], 1)
|
733 | 741 | self._isinit = True
|
734 | 742 | self._set_extremes()
|
|
0 commit comments