Announcement

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

  • Labeling a stacked graph bar

    Good evening,
    The bars in my chart are only numbered not labeled. How can I label them correctly and change the colors?

    graph bar (sum) var1 var2, over(catvar1) over(catvar2) asyvars percentage stack

    Thanks

  • #2
    Given asyvars you can specify colors in options like bar(1, )

    You also can also specify blabel().

    This is all documented in the help. Here's a dopey example.

    Code:
    sysuse auto, clear
    set scheme s1color 
    graph bar (sum) price, over(foreign) over(rep78) stack asyvars bar(1, fcolor(red*0.2) lcolor(red)) bar(2, fcolor(blue*0.2) lcolor(blue)) blabel(total, pos(center))

    Comment


    • #3
      Hey, thanks for the quick response. I was able to change colors as intended. However I wanted to label the bars below the x axis I guess. Not the single stacked parts. Is that possible?

      Comment


      • #4
        The categorical axis (see the help for why it's not called an x axis) shows the values of rep78 in the example given. If value labels were defined they would be shown instead. So I am at a loss to know what you are missing without a data example or an example of the graph.

        Comment


        • #5
          Yeah no value labels defined. Thats the problem, I fixed it now. Thank you

          Comment

          Working...
          X