以下代码为每个类别提供了不同的颜色
import seaborn as sns
sns.set(style="darkgrid")
titanic = sns.load_dataset("titanic")
ax = sns.countplot(x="class", data=titanic)
最佳答案
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/