seaborn.cubehelix_palette#

seaborn.cubehelix_palette(n_colors=6, start=0, rot=0.4, gamma=1.0, hue=0.8, light=0.85, dark=0.15, reverse=False, as_cmap=False)#

Make a sequential palette from the cubehelix system.

This produces a colormap with linearly-decreasing (or increasing) brightness. That means that information will be preserved if printed to black and white or viewed by someone who is colorblind. “cubehelix” is also available as a matplotlib-based palette, but this function gives the user more control over the look of the palette and has a different set of defaults.

In addition to using this function, it is also possible to generate a cubehelix palette generally in seaborn using a string starting with ch: and containing other parameters (e.g. "ch:s=.25,r=-.5").

Parameters:
n_colorsint

Number of colors in the palette.

startfloat, 0 <= start <= 3

The hue value at the start of the helix.

rotfloat

Rotations around the hue wheel over the range of the palette.

gammafloat 0 <= gamma

Nonlinearity to emphasize dark (gamma < 1) or light (gamma > 1) colors.

huefloat, 0 <= hue <= 1

Saturation of the colors.

darkfloat 0 <= dark <= 1

Intensity of the darkest color in the palette.

lightfloat 0 <= light <= 1

Intensity of the lightest color in the palette.

reversebool

If True, the palette will go from dark to light.

as_cmapbool

If True, return a matplotlib.colors.ListedColormap.

Returns:
palette

list of RGB tuples or matplotlib.colors.ListedColormap

See also

choose_cubehelix_palette

Launch an interactive widget to select cubehelix palette parameters.

dark_palette

Create a sequential palette with dark low values.

light_palette

Create a sequential palette with bright low values.

References

Green, D. A. (2011). “A colour scheme for the display of astronomical intensity images”. Bulletin of the Astromical Society of India, Vol. 39, p. 289-295.

Examples

Return a discrete palette with default parameters:

sns.cubehelix_palette()

Increase the number of colors:

sns.cubehelix_palette(8)

Return a continuous colormap rather than a discrete palette:

sns.cubehelix_palette(as_cmap=True)
seaborn_cubehelix color map

Change the starting point of the helix:

sns.cubehelix_palette(start=2)

Change the amount of rotation in the helix:

sns.cubehelix_palette(rot=.2)

Rotate in the reverse direction:

sns.cubehelix_palette(rot=-.2)

Apply a nonlinearity to the luminance ramp:

sns.cubehelix_palette(gamma=.5)

Increase the saturation of the colors:

sns.cubehelix_palette(hue=1)

Change the luminance at the start and end points:

sns.cubehelix_palette(dark=.25, light=.75)

Reverse the direction of the luminance ramp:

sns.cubehelix_palette(reverse=True)