mwaskom / seaborn

Statistical data visualization in Python
https://seaborn.pydata.org
BSD 3-Clause "New" or "Revised" License
12.18k stars 1.89k forks source link

Feature Request: Allow `multiple` parameter in `sns.countplot` #3722

Closed Hari-Shankar-Karthik closed 5 days ago

Hari-Shankar-Karthik commented 5 days ago

Heyy devs of seaborn!

I was wondering whether it might be possible to include multiple keyword in sns.counplot, similar to how it works in sns.histplot. For example, I have a dataset containing tweets by users about airlines and whether they are positive, negative or neutral. I want to make a countplot of each type of tweet per airline.

If I do sns.countplot(data=airline_tweets, y='airline', hue='airline_sentiment'), I get:

current

The behaviour I want to get is similar to doing

import seaborn.objects as so
so.Plot(airline_tweets, x='airline', color='airline_sentiment').add(so.Bar(), so.Count(), so.Stack())

wanted

I want to be able to get this by doing sns.countplot(data=airline_tweets, y='airline', hue='airline_sentiment', multiple='stack')

Thank you!

mwaskom commented 5 days ago

I would just use histplot here.

Hari-Shankar-Karthik commented 4 days ago

Thanks so much! I did sns.histplot(airline_tweets, x='airline', hue='airline_sentiment', multiple='stack') and got what I expected.