Announcement

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

  • Increasing the gap between bar charts- Twoway bar

    Hi everyone,

    I was wondering if anyone could help me with increasing the gap between the bar charts in two-way bar graphs?

    My code is:

    twoway bar pc_immig1 naics_21 if tag1 & inlist(naics_21, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 ,21),[fw=fweight]||
    scatter pc_immig1 naics_21 if tag1 & inlist(naics_21, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 ,21), mlabel(pc_immig1)||,
    xla(1/21, valuelabel) ytitle(% of immigrants)

    I tried using bargap(1) in my code but it says isn't invalid

    Click image for larger version

Name:	Screen Shot 2021-06-12 at 2.33.20 PM.png
Views:	1
Size:	97.2 KB
ID:	1614382


  • #2
    You should shorten your labels and create a horizontal bar chart so that the categories appear on the y-axis (and thus are legible). Also, it would make sense to sort the bars. For your question, you need the option -barwidth()-, specifying a negative value, e.g.,

    Code:
    barwidth(-0.8)

    Comment


    • #3
      barw() would accept -0.8 but 0.8 works in the same way.

      Comment

      Working...
      X