简体   繁体   English

为什么 seaborn 中没有应用调色板?

[英]Why isn't the color palette applied in seaborn?

When plotting histplot, I can't apply the color palette, what's the problem?绘制 histplot 时,我无法应用调色板,这是什么问题? In other plottings, the palette works.在其他绘图中,调色板有效。 Here is my code:这是我的代码:

plt.figure(figsize=(15, 8))
sns.histplot(x='age', data=df, bins = 20)
sns.color_palette('plasma', as_cmap=True)
plt.show()

Thanks for the help.谢谢您的帮助。

You should specify the palette in the same visual:您应该在同一视觉对象中指定调色板:

plt.figure(figsize=(15, 8))
sns.histplot(x='age', data=df, bins = 20,palette='plasma')
plt.show()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM