limit the number of groups shown in seaborn countplot?

后端 未结 2 609
借酒劲吻你
借酒劲吻你 2020-12-24 13:23

Is it possible to show only the top/bottom n groups in asns.countplot()?

Using an example from the seaborn website,

sns.countplot         


        
2条回答
  •  情话喂你
    2020-12-24 14:23

    import seaborn as sns
    titanic = sns.load_dataset("titanic")
    sns.countplot(y="deck", hue="class", data=titanic, palette="Greens_d",
                  order=titanic.deck.value_counts().iloc[:3].index)
    

提交回复
热议问题