PerceptualColormap.from_list¶
- classmethod PerceptualColormap.from_list(*args, adjust_grays=True, **kwargs)[source]¶
Make a
PerceptualColormapfrom a list of colors.- Parameters
colors (
listofcolor-specorfloat,color-spec tuples) – If list of RGB[A] tuples or color strings, the colormap transitions evenly fromcolors[0]at the left-hand side tocolors[-1]at the right-hand side.If list of (float, color-spec) tuples, the float values are the coordinate of each transition and must range from 0 to 1. This can be used to divide the colormap range unevenly.
name (
str, optional) – The colormap name. This can also be passed as the first positional string argument. Default is'_no_name'.ratios (
listoffloat, optional) – Relative extents of each color transition. Must have lengthlen(colors) - 1. Larger numbers indicate a slower transition, smaller numbers indicate a faster transition. For example,('red', 'blue', 'green')withratios=(2, 1)creates a colormap with the transition from red to blue taking twice as long as the transition from blue to green.adjust_grays (
bool, optional) – Whether to adjust the hues of grayscale colors (including'white'and'black') to the hues of the preceding and subsequent colors in the list. This facilitates the construction of diverging colormaps with monochromatic segments using input likePerceptualColormap.from_list(['blueish', 'white', 'reddish']).
- Other Parameters
**kwargs – Passed to
PerceptualColormap.- Returns
PerceptualColormap– The colormap.