PerceptuallyUniformColormap¶
-
class
PerceptuallyUniformColormap(name, segmentdata, N=None, space=None, clip=True, gamma=None, gamma1=None, gamma2=None, **kwargs)[source]¶ Bases:
proplot.styletools.LinearSegmentedColormap,proplot.styletools._ColormapSimilar to
LinearSegmentedColormap, but instead of varying the RGB channels, we vary hue, saturation, and luminance in either the HCL colorspace or the HSLuv or HPLuv scalings of HCL.- Parameters
name (str) – The colormap name.
segmentdata (dict-like) – Mapping containing the keys
'hue','saturation', and'luminance'. The key values can be callable functions that return channel values given a colormap index, or lists containing any of the following channel specifiers.Numbers, within the range 0-360 for hue and 0-100 for saturation and luminance.
Color string names or hex tags, in which case the channel value for that color is looked up.
See
LinearSegmentedColormapfor a more detailed explanation.N (int, optional) – Number of points in the colormap lookup table. Default is
rc[‘image.lut’]=256.space ({‘hcl’, ‘hsl’, ‘hpl’}, optional) – The hue, saturation, luminance-style colorspace to use for interpreting the channels. See this page for a description.
clip (bool, optional) – Whether to “clip” impossible colors, i.e. truncate HCL colors with RGB channels with values >1, or mask them out as gray.
gamma1 (float, optional) – If >1, makes low saturation colors more prominent. If <1, makes high saturation colors more prominent. Similar to the HCLWizard option. See
make_mapping_arrayfor details.gamma2 (float, optional) – If >1, makes high luminance colors more prominent. If <1, makes low luminance colors more prominent. Similar to the HCLWizard option. See
make_mapping_arrayfor details.gamma (float, optional) – Use this to identically set
gamma1andgamma2at once.**kwargs – Passed to
LinearSegmentedColormap.
Example
The following generates a
PerceptuallyUniformColormapfrom asegmentdatadictionary that uses color names for the hue data, instead of channel values between0and360.>>> import proplot as plot >>> data = { ... 'hue': [[0, 'red', 'red'], [1, 'blue', 'blue']], ... 'saturation': [[0, 100, 100], [1, 100, 100]], ... 'luminance': [[0, 100, 100], [1, 20, 20]], ... } >>> cmap = plot.PerceptuallyUniformColormap(data)
Methods Summary
from_color(name, color[, fade, space])Returns a monochromatic “sequential” colormap that blends from white or near-white to the input color.
from_hsl(name[, hue, saturation, luminance, …])Makes a
PerceptuallyUniformColormapby specifying the hue, saturation, and luminance transitions individually.from_list(name, colors[, ratios])Make a
PerceptuallyUniformColormapfrom a list of colors.set_gamma([gamma, gamma1, gamma2])Set new gamma value(s) and regenerates the colormap.
updated([name, segmentdata, N, alpha, …])Returns a new colormap, with relevant properties copied from this one if they were not provided as keyword arguments.