I am working on a social media dataset that contains yes/no responses from Adults and High school respondents. I want to create small multiples grouped bar plots. Each individual plot (for a given social media platform), should be a grouped bar chart with two items on the axis (HS and Adult) and a bar for the number of yes and no responses.
I am using the seaborn library and counting and plotting the responses using sns.countplot(). My graph is showing good results for a few columns, but it is also showing wide bars for the plots where users' response is 'NO'. Can anyone please help.
My code:
I am using the seaborn library and counting and plotting the responses using sns.countplot(). My graph is showing good results for a few columns, but it is also showing wide bars for the plots where users' response is 'NO'. Can anyone please help.
My code:
import seaborn as sns plt.figure(figsize = (25,25)) sm_df = sm.drop(columns=['Adult']) count = 0 for cols in sm_df.columns: plt.subplot(7,3,count+1) sns.countplot('Adult', hue = cols, palette = "Set2", data = sm) plt.xlabel(cols) plt.tight_layout() count+=1 plt.show()
buran write Dec-05-2020, 10:03 AM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.