为了账号安全,请及时绑定邮箱和手机立即绑定

从 Seaborn 调色板中选择颜色

从 Seaborn 调色板中选择颜色

元芳怎么了 2021-10-19 09:42:04
我有五个并排分布图,通常使用 color 属性更改每个分布图的颜色。但是,现在我想使用 Seaborn 的 husl 调色板,但我不知道如何将调色板中的颜色应用于每个图表。我很确定这只是我在看的东西。# sns.set(style="white", palette="muted", color_codes=True)  sns.set(style="white", palette="husl", color_codes=True)# Set up the matplotlib figuref, axes = plt.subplots(ncols=5, figsize=(15, 4))sns.despine(left=True)# Rating of 1sns.distplot(df1[df1['rating']==1]['cost'], kde=False, color='c', ax=axes[0], axlabel="Rating of 1")# Rating of 2sns.distplot(df1[df1['rating']==2]['cost'], kde=False, color='k', ax=axes[1], axlabel='Rating of 2')# Rating of 3sns.distplot(df1[df1['rating']==3]['cost'], kde=False, color="g", ax=axes[2], axlabel='Rating of 3')# Rating of 4sns.distplot(df1[df1['rating']==4]['cost'], kde=False, color="m", ax=axes[3], axlabel='Rating of 4')# Rating of 5sns.distplot(df1[df1['rating']==5]['cost'], kde=False, color="b", ax=axes[4], axlabel='Rating of 5')plt.setp(axes, yticks=[])plt.tight_layout()
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 392 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号