Announcement

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

  • Bar graph bar width

    Hey!

    I'm creating a simple bar graph and I have difficulties to change the width of the bars. When I try 'barwidth', then I get the error that this option is not allowed. I tried with the following code with 'bargap' and I don't obtain an error message but nothing changes. Can you please help me?

    Best regards Christoph


    Code:
     recode pgma (0=2)
    #delimit ;
    graph bar (mean) prelapse, over(pgma)
    bargap(-30)
    note("Source: Created by the author based on PGMD and UCDP data")
    scheme(s1mono)
    blabel(bar, position(outside))
    ytitle("Percentage of recurring conflicts to total number of conflicts")
    title("Relative frequencies of conflict recurrences")
    legend(label(1 "conflicts with previous PGM activities") label(2 "conflicts without previous PGM activities"))
    name(grapha, replace);
    #delimit cr    
    recode pgma (2=0)

  • #2
    Same broad problem, I guess, as with your other thread. The option -barwidth()- is twoway syntax in a non-twoway graph.
    Last edited by Nick Cox; 11 May 2016, 07:11.

    Comment


    • #3
      Thanks! So is there no chance at all to change my bar width of a graph bar? Can I do the same graph instead with a twoway graph? How would the beginning look like?

      Comment


      • #4
        Or can I at least make this changes in the editor?

        Comment


        • #5
          You don't give a reproducible example: see FAQ Advice #12. But consider this:

          Code:
          sysuse auto, clear
          graph bar (mean) mpg, over(rep78)
          graph bar (mean) mpg, over(rep78, gap(*5))
          The bigger the gap between bars ... the smaller they are.

          Comment


          • #6
            Is there any way to adjust the width of the bar when there is only one bar in the graph? For instance, I only have two variables in the graph and they are stacked on top of one another. Functionally speaking, there's nothing wrong with the graph Stata is producing, I just think it would look more visually appealing if there bar was less wide. I have played around with adjusting X Size, but I'd prefer to keep the whole graph relatively square looking.

            Thanks in advance for any help provided here.

            Comment

            Working...
            X