Announcement

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

  • Twoway stacked bar graph with two bars per year

    Dear all,

    I am trying to do a stacked bar graph with two bars, one for females and for males, over different years but have not succeeded.

    I have three types of incomes that I want to stack in one bar for each gender over different years. I have prepared the variables like the following (the variables are all shares of the total, so the shares will be 100 % in total)

    B (business income) = a
    C (capital income) = a + b
    L (labor income) = a + b + c

    I have tried the following:

    twoway (bar B_female year || rbar B_female C_female year || rbar C_female L_female year) ///
    (bar B_male year || rbar B_male C_male year || rbar C_male L_male year) , ///
    legend( label(1 "Business inc") label(2 "Capital inc") label(3 "Earned inc")) ///
    title("Income composition at diff points in time")

    but it doesn't give me two stacked bars.

    Does anyone know how to do?

    All help is appreciated!


    Thank you!


    Best regards,

    Kristin

  • #2
    Hello Kristin,

    Any luck with this style graphic? I've been attempting something similar for several days now, and have not yet been successful.

    Comment


    • #3
      I found this link helpful:

      http://www.stata.com/statalist/archi.../msg00725.html

      There might very well be a better method, however I was able to get this one to work for my situation. Good luck!

      Comment


      • #4
        #1 was probably not answered because it didn't follow advice e.g. http://www.statalist.org/forums/help#stata There is no reproducible example, and no graph to look at. People won't often work at creating analogue data and firing up the commands to see what the problem is precisely.

        The same is true of #2 and #3.

        Comment

        Working...
        X