I want to create small multiples grouped bar plot, and facing some aesthetics issuess - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: I want to create small multiples grouped bar plot, and facing some aesthetics issuess (/thread-31339.html) |
I want to create small multiples grouped bar plot, and facing some aesthetics issuess - dev_kaur - Dec-05-2020 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: 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() |