PerceptualColormap.from_hsl

classmethod PerceptualColormap.from_hsl(*args, **kwargs)[source]

Make a PerceptualColormap by specifying the hue, saturation, and luminance transitions individually.

Parameters
  • space ({'hsl', 'hpl', 'hcl', 'hsv'}, optional) – The hue, saturation, luminance-style colorspace to use for interpreting the channels. See this page for a full description. Default is 'hsl'.

  • name (str, optional) – The colormap name. This can also be passed as the first positional string argument. Default is '_no_name'.

  • ratios (sequence 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, luminance=(100, 50, 0) with ratios=(2, 1) results in a colormap with the transition from luminance 100 to 50 taking twice as long as the transition from luminance 50 to 0.

  • h, s, l, a, c – Shorthands for hue, saturation, luminance, alpha, and chroma.

  • hue (float or color-spec or sequence, optional) – Hue channel value or sequence of values. The shorthand keyword h is also acceptable. Values can be any of the following.

    1. Numbers, within the range 0 to 360 for hue and 0 to 100 for saturation and luminance.

    2. Color string names or hex strings, in which case the channel value for that color is looked up.

    If scalar, the hue does not change across the colormap. Default is 0 (i.e., red).

  • saturation, luminance, alpha (float or color-spec or sequence, optional) – As with hue, but for the saturation, luminance, and alpha (opacity) channels, respectively. The default saturation is 50, luminance is (100, 20), and alpha is 1 (i.e., no transparency).

  • chroma – Alias for saturation.

Other Parameters

**kwargs – Passed to PerceptualColormap.

Returns

PerceptualColormap – The colormap.