|
25 | 25 | from matplotlib import _api, animation, cbook
|
26 | 26 | from matplotlib.cbook import ls_mapper
|
27 | 27 | from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
|
28 |
| -from matplotlib.colors import is_color_like |
| 28 | +from matplotlib.colors import Colormap, is_color_like |
29 | 29 |
|
30 | 30 | # Don't let the original cycler collide with our validating cycler
|
31 | 31 | from cycler import Cycler, cycler as ccycler
|
@@ -393,6 +393,13 @@ def validate_color(s):
|
393 | 393 |
|
394 | 394 | validate_colorlist = _listify_validator(
|
395 | 395 | validate_color, allow_stringlist=True, doc='return a list of colorspecs')
|
| 396 | + |
| 397 | + |
| 398 | +def _validate_cmap(s): |
| 399 | + cbook._check_isinstance((str, Colormap), cmap=s) |
| 400 | + return s |
| 401 | + |
| 402 | + |
396 | 403 | validate_orientation = ValidateInStrings(
|
397 | 404 | 'orientation', ['landscape', 'portrait'], _deprecated_since="3.3")
|
398 | 405 |
|
@@ -1141,7 +1148,7 @@ def _convert_validator_spec(key, conv):
|
1141 | 1148 |
|
1142 | 1149 | "image.aspect": validate_aspect, # equal, auto, a number
|
1143 | 1150 | "image.interpolation": validate_string,
|
1144 |
| - "image.cmap": validate_string, # gray, jet, etc. |
| 1151 | + "image.cmap": _validate_cmap, # gray, jet, etc. |
1145 | 1152 | "image.lut": validate_int, # lookup table
|
1146 | 1153 | "image.origin": ["upper", "lower"],
|
1147 | 1154 | "image.resample": validate_bool,
|
|
0 commit comments