Python全系列 教程
3567个小节阅读:5929.4k
目录
鸿蒙应用开发
C语言快速入门
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
颜色比图形样式的其他方面更重要,因为如果有效使用颜色可以更凸显示数据的结果与重要
Seaborn可以轻松选择和使用适合您正在使用的数据类型的调色板以及您可视化的目标
color_palette() 能传入任何Matplotlib所支持的颜色
color_palette() 不写参数则,默认颜色 deep, muted, pastel, bright, dark, colorblind
color_palette() ["#9b59b6", "#3498db", "#95a5a6", "#e74c3c", "#34495e", "#2ecc71"]
light_palette()
dark_palette()
set_palette()设置所有图的颜色
xxxxxxxxxx
current_palette = sns.color_palette()
sns.palplot(current_palette)
xxxxxxxxxx
current_palette = sns.color_palette('dark')
sns.palplot(current_palette) #10个色块
sns.palplot(sns.color_palette('hls',8))#8个颜色,色度比较亮
xxxxxxxxxx
sns.palplot(sns.color_palette('Blues'))
sns.palplot(sns.color_palette('Greens_r')) #参数里可以输入数字,指定颜色的块数,_r由深到浅
xxxxxxxxxx
sns.palplot(sns.light_palette('green'))
sns.palplot(sns.dark_palette('purple'))
从xkcd_rgb这产生了一组颜色https://xkcd.com/color/rgb/,可以使用xkcd_rgb在seaborn中引用它们
xxxxxxxxxx
sns.xkcd_palette(['dark pink','algae','spring green','greyish blue'])
xxxxxxxxxx
x = range(5,11)
plt.bar(x,x,color=sns.color_palette('Reds'))
sns.barplot(x='sex', y='size', data=data,palette=sns.color_palette(n_colors=2),hue='sex')
实时学习反馈
1. 使用seaborn调色板,下划线处需要填写的代码是_____:
xxxxxxxxxx
x = range(5,11)
plt.bar(x,x,_________)
A color=plt.color('Reds')
B color=sns.color_palette('Reds')
2. 使用seaborn调色板,说法错的是?
A 调色板可以获取指定的颜色
B 调色板可以获取指定个数的颜色
C 调色板必须搭配sns图表使用
答案
1=>C