seaborn.
diverging_palette
(h_neg, h_pos, s=75, l=50, sep=10, n=6, center='light', as_cmap=False)¶Make a diverging palette between two HUSL colors.
If you are using the IPython notebook, you can also choose this palette
interactively with the choose_diverging_palette()
function.
Parameters: | h_neg, h_pos : float in [0, 359]
s : float in [0, 100], optional
l : float in [0, 100], optional
n : int, optional
center : {“light”, “dark”}, optional
as_cmap : bool, optional
|
---|---|
Returns: | palette or cmap : seaborn color palette or matplotlib colormap
|
See also
dark_palette
light_palette
Examples
Generate a blue-white-red palette:
>>> import seaborn as sns; sns.set()
>>> sns.palplot(sns.diverging_palette(240, 10, n=9))
Generate a brighter green-white-purple palette:
>>> sns.palplot(sns.diverging_palette(150, 275, s=80, l=55, n=9))
Generate a blue-black-red palette:
>>> sns.palplot(sns.diverging_palette(250, 15, s=75, l=40,
... n=9, center="dark"))
Generate a colormap object:
>>> from numpy import arange
>>> x = arange(25).reshape(5, 5)
>>> cmap = sns.diverging_palette(220, 20, sep=20, as_cmap=True)
>>> ax = sns.heatmap(x, cmap=cmap)