|
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 |
|
@@ -362,7 +363,7 @@ class ColorConverter(object): |
362 | 363 | ### End of backwards-compatible color-conversion API |
363 | 364 |
|
364 | 365 |
|
365 | | -def makeMappingArray(N, data, gamma=1.0): |
| 366 | +def _create_lookup_table(N, data, gamma=1.0): |
366 | 367 | r"""Create an *N* -element 1-d lookup table. |
367 | 368 |
|
368 | 369 | This assumes a mapping :math:`f : [0, 1] \rightarrow [0, 1]`. The returned |
@@ -460,6 +461,13 @@ def makeMappingArray(N, data, gamma=1.0): |
460 | 461 | return np.clip(lut, 0.0, 1.0) |
461 | 462 |
|
462 | 463 |
|
| 464 | +@cbook.deprecated("3.2", |
| 465 | + addendum='This is not considered public API any longer.') |
| 466 | +@docstring.copy(_create_lookup_table) |
| 467 | +def makeMappingArray(N, data, gamma=1.0): |
| 468 | + return _create_lookup_table(N, data, gamma) |
| 469 | + |
| 470 | + |
463 | 471 | class Colormap(object): |
464 | 472 | """ |
465 | 473 | Baseclass for all scalar to RGBA mappings. |
@@ -729,14 +737,14 @@ def __init__(self, name, segmentdata, N=256, gamma=1.0): |
729 | 737 |
|
730 | 738 | def _init(self): |
731 | 739 | self._lut = np.ones((self.N + 3, 4), float) |
732 | | - self._lut[:-3, 0] = makeMappingArray( |
| 740 | + self._lut[:-3, 0] = _create_lookup_table( |
733 | 741 | self.N, self._segmentdata['red'], self._gamma) |
734 | | - self._lut[:-3, 1] = makeMappingArray( |
| 742 | + self._lut[:-3, 1] = _create_lookup_table( |
735 | 743 | self.N, self._segmentdata['green'], self._gamma) |
736 | | - self._lut[:-3, 2] = makeMappingArray( |
| 744 | + self._lut[:-3, 2] = _create_lookup_table( |
737 | 745 | self.N, self._segmentdata['blue'], self._gamma) |
738 | 746 | if 'alpha' in self._segmentdata: |
739 | | - self._lut[:-3, 3] = makeMappingArray( |
| 747 | + self._lut[:-3, 3] = _create_lookup_table( |
740 | 748 | self.N, self._segmentdata['alpha'], 1) |
741 | 749 | self._isinit = True |
742 | 750 | self._set_extremes() |
|
0 commit comments