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-shorthand; see the example below.
Parameters: |
|
---|---|
Returns: |
|
See also
choose_cubehelix_palette
dark_palette
light_palette
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
Generate the default palette:
>>> import seaborn as sns; sns.set()
>>> sns.palplot(sns.cubehelix_palette())
Rotate backwards from the same starting location:
>>> sns.palplot(sns.cubehelix_palette(rot=-.4))
Use a different starting point and shorter rotation:
>>> sns.palplot(sns.cubehelix_palette(start=2.8, rot=.1))
Reverse the direction of the lightness ramp:
>>> sns.palplot(sns.cubehelix_palette(reverse=True))
Generate a colormap object:
>>> from numpy import arange
>>> x = arange(25).reshape(5, 5)
>>> cmap = sns.cubehelix_palette(as_cmap=True)
>>> ax = sns.heatmap(x, cmap=cmap)
Use the full lightness range:
>>> cmap = sns.cubehelix_palette(dark=0, light=1, as_cmap=True)
>>> ax = sns.heatmap(x, cmap=cmap)
Use through the color_palette()
interface:
>>> sns.palplot(sns.color_palette("ch:2,r=.2,l=.6"))