Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Catplot - bar width

    Dear all,

    I am trying to plot stacked bar charts using -catplot-. I would like to reduce the width of the bars (to half or even one-third). I tried using over(gender, gap(*5), while this does reduce the width of the bars, the distance between them is a bit much. Is there anyway I can reduce the width of the bars but still keep them relatively close? Any help will be appreciated.

    Best regards,

    Chiara


    Code:
    ssc install catplot
    Code:
    clear
    input double gender float skip
    1 0
    0 0
    0 1
    1 0
    1 0
    0 1
    1 1
    0 1
    1 1
    0 0
    end
    label values gender hgender_lab
    label def hgender_lab 0 "Male", modify
    label def hgender_lab 1 "Female", modify
    label values skip skip_axis
    label def skip_axis 0 "No", modify
    label def skip_axis 1 "Yes", modify
    Code:
    catplot skip, over(gender) percent(gender) asyvars stack ///
    blabel(bar, size(3) position(center)orient(horiz) format(%4.1f)) ///
    ytitle("Share of respondents (%)") ylabel (, nogrid) ///
    bar(1, bcolor(ebblue)) bar(2, bcolor(cranberry)) legend(label(1 "No") label(2 "Yes")) /// 
    title(" ") l1title("") graphregion(color(white)) bgcolor(white)

  • #2
    Specify an aspect ratio less than 1, e.g., -aspect(0.25)-. See

    Code:
    help aspect_option

    Comment


    • #3
      Andrew Musau, thank you! This works.

      Best,

      Chiara

      Comment

      Working...
      X