matplotlib - 为 seaborn countplot 中的所有条应用单一颜色

标签 matplotlib seaborn

以下代码为每个类别提供了不同的颜色

import seaborn as sns
sns.set(style="darkgrid")
titanic = sns.load_dataset("titanic")
ax = sns.countplot(x="class", data=titanic)

如何让它们都具有相同的颜色? enter image description here

最佳答案

documentation :

seaborn.countplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None, orient=None, color=None, palette=None, saturation=0.75, dodge=True, ax=None, **kwargs)

函数接受颜色参数,改变它来改变颜色。

关于matplotlib - 为 seaborn countplot 中的所有条应用单一颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62098788/

相关文章:

python - Seaborn 热图中的自定义调色板

python - 在多个轴上绘制预先计算的图表

python - 我用 pyAudio 测量什么?

python - Matplotlib:条形图上方的网格线

python - Seaborn.despine() 消除将 y 轴移动到图右侧的效果

python - 为不同的类别级别绘制不同的颜色

python - 将背景颜色图的大小设置为 seaborn jointplot 中的轴大小

python - Matplotlib Python : How to add panel button

Python - 在 z 平面上切片

python - MatPlotLib 散点图删除