seaborn.
diverging_palette
(h_neg, h_pos, s=75, l=50, sep=1, n=6, center='light', as_cmap=False)¶在两种外壳颜色之间做一个不同的调色板。
如果您使用的是IPython笔记本,还可以与 choose_diverging_palette()
功能。
地图正负范围的锚定色调。
地图两个范围的锚定饱和度。
为地图的两个范围锚定亮度。
中间区域的大小。
调色板中的颜色数(如果不返回cmap)
调色板的中心是亮还是暗
如果为True,则返回 matplotlib.colors.Colormap
.
matplotlib.colors.Colormap
参见
dark_palette
创建具有暗值的顺序调色板。
light_palette
创建具有灯光值的顺序调色板。
实例
生成蓝白红调色板:
>>> import seaborn as sns; sns.set_theme()
>>> sns.palplot(sns.diverging_palette(240, 10, n=9))
生成更亮的绿-白-紫调色板:
>>> sns.palplot(sns.diverging_palette(150, 275, s=80, l=55, n=9))
生成蓝-黑-红调色板:
>>> sns.palplot(sns.diverging_palette(250, 15, s=75, l=40,
... n=9, center="dark"))
生成colormap对象:
>>> from numpy import arange
>>> x = arange(25).reshape(5, 5)
>>> cmap = sns.diverging_palette(220, 20, as_cmap=True)
>>> ax = sns.heatmap(x, cmap=cmap)