PerceptuallyUniformColormap.from_list¶
-
static
PerceptuallyUniformColormap.
from_list
(name, colors, ratios=None, **kwargs)[source]¶ Make a
PerceptuallyUniformColormap
from a list of colors.- Parameters
name (str) – The colormap name.
colors (list of color-spec or (float, color-spec) tuples, optional) – If list of RGB[A] tuples or color strings, the colormap transitions evenly from
colors[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.
ratios (list of float, optional) – Relative extents of each color transition. Must have length
len(colors) - 1
. Larger numbers indicate a slower transition, smaller numbers indicate a faster transition.For example,
red=[1,0.5,0]
withratios=[2,1]
results in a colormap with the transition from red1
to0.5
taking twice as long as the transition from red0.5
to0
.
- Other Parameters
**kwargs – Passed to
PerceptuallyUniformColormap
.- Returns
PerceptuallyUniformColormap
– The colormap.