Seaborn 颜色画板

怎样调用调色板?

  • color_palette()能传入任何Matplotlib所支持的颜色
  • color_palette()不写参数则默认颜色
  • set_palette() 设置所有图的颜色
current_palette = sns.color_palette()
sns.palplot(current_palette)
image.png

分类色板

分类色板(定性)是在区分没有固定顺序的数据时最好的选择。
默认颜色主题共有六种不同的变化分别是:deep, muted, pastel, bright, dark, 和 colorblind。

current_palette = sns.color_palette('colorblind')
sns.palplot(current_palette)
image.png

圆形画板

当有六个以上的分类要区分时,最简单的方法就是在一个圆形的颜色空间中画出均匀间隔的颜色(这样的色调会保持亮度和饱和度不变)。这是大多数的当他们需要使用比当前默认颜色循环中设置的颜色更多时的默认方案。
最常用的方法是使用hls的颜色空间,这是RGB值的一个简单转换。

sns.palplot(sns.color_palette("hls", 9))
image.png

可以使用hls_palette()来改变亮度和饱和度

sns.palplot(sns.hls_palette(9, l=.8, s=.5)) # l 亮度 s 饱和度
image.png

成对的颜色

sns.palplot(sns.color_palette("Paired",10))

渐变色

sns.palplot(sns.color_palette("Blues"))
image.png

加_r表示反转

sns.palplot(sns.color_palette("Blues_r"))
image.png

light_palette()和dark_palette()

sns.palplot(sns.light_palette("green"))
image.png
sns.palplot(sns.dark_palette("green"))
image.png
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容