-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't use catplot with melt for different categories #1702
Comments
Indeed, (Notes to myself: this is a bit tricky because it will have to figure out from the Anyway you can use g = sns.FacetGrid(ames_cat.melt(), col="variable", sharex=False, sharey=False, col_wrap=5)
g.map(sns.countplot, "value", order=None) (If I understand what you're aiming for, this should do it). |
It does! someone should collect all your issue replies and make a seaborn cook-book. I'm not sure if I understand your explanation as I'm using |
Ok possibly silly follow-up: Is this the idiomatic way to make the bars horizontal? g = sns.FacetGrid(ames_cat.melt(), col="variable", sharex=False, sharey=False, col_wrap=5)
g.map(lambda x, **kwargs: sns.countplot(y=x, **kwargs), "value", order=None) |
I'm going to keep this open because — while I think that Facet Grid plots should generally share x/y axes — |
I've been meaning to let you pass g = sns.FacetGrid(ames_cat.melt(), col="variable", sharex=False, sharey=False, col_wrap=5)
g.map_dataframe(sns.countplot, y="value", order=None) The one disadvantage is that you'd need to set the axes labels yourself ( |
Thank you, I'll look more into map_dataframe! |
I'm having the same issue for countplot with dodge position. I'm using this dataset from Kaggle.
the following code provides dodge position but
any idea? |
I would have expected that I can visualize different categorical variables in a count plot using
catplot
andmelt
.However, it looks like the data is converted to categorical before grouping for the columns, and so the categories are shared among all the count plots. That doesn't really make sense if the different columns correspond to different categories.
Am I overlooking something or is there a different way of doing this?
The text was updated successfully, but these errors were encountered: