Python Forum
I want to create small multiples grouped bar plot, and facing some aesthetics issuess
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I want to create small multiples grouped bar plot, and facing some aesthetics issuess
#1
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()
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Facing issue in python regex newline match Shr 6 1,292 Oct-25-2023, 09:42 AM
Last Post: Shr
  Create simple live plot of stock data dram 2 2,921 Jan-27-2023, 04:34 AM
Last Post: CucumberNox
  Facing problem with Pycharm - Not getting the expected output amortal03 1 858 Sep-09-2022, 05:44 PM
Last Post: Yoriz
  grouped bar graphs tobiasfw 1 1,405 Feb-22-2022, 02:25 PM
Last Post: deanhystad
  Facing Problem while opening a file through command prompt vlearner 4 1,909 Jan-30-2022, 08:10 AM
Last Post: snippsat
  Facing error while executing below Python code ramu4651 1 5,734 Jan-26-2021, 06:40 PM
Last Post: ibreeden
  How to plot intraday data of several days in one plot mistermister 3 2,915 Dec-15-2020, 07:43 PM
Last Post: deanhystad
  Facing issue while saving workbook Abhisht 3 5,590 Aug-19-2020, 11:44 AM
Last Post: Larz60+
  Read Multiples Text Files get specific lines based criteria zinho 5 3,124 May-19-2020, 12:30 PM
Last Post: zinho
  how to make a program with a certain number of multiples? syafiq14 3 2,768 Jan-01-2020, 02:39 PM
Last Post: syafiq14

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020