Announcement

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

  • twoway bar with stack option and connected lines

    Hello All,
    I am trying to make a bar graph with 6 variables. I need to stack them up over years and need to add 3 other variables on the same graph as connected lines. Basically, I want to have stacked bars and connected lines on the same graph.
    I tried this code: "twoway bar var1 year || rbar var1 var2 year || var1 var2 var3 year || line var7 var8 var9 year"
    I got error message as; "rbar requires 3 variables" , basically rbar does not work with more than three vars.
    I would appreciate for any help.
    Thanks

    Hakan Uslu

  • #2
    Your statement that rbar does not work with more than three variables is correct but does not appear to apply to your code.

    The fragment

    Code:
     
    var1 var2 var3 year
    doesn't define a legal graph command. I guess you meant

    Code:
     
    rbar var2 var3 year

    Comment


    • #3
      Hi Nick,
      Yes, But it is a typo. I meant "rbar var1 var2 var3 year". However, Four variables are not good for rbar command.
      I also tried "graph bar" command with stack option. This worked for making bars for 5 variables over 'year' variable, but I could not add a connected line on the same graph for other 3 variables.
      Do you know any other command to make stacked bars and connected lines on the same graph?
      thanks

      Hakan Uslu

      Comment


      • #4
        I already suggested what I think will work for you. To spell it all out,

        Code:
         
        twoway bar var1 year || rbar var1 var2 year || rbar var2 var3 year || line var7 var8 var9 year

        Comment

        Working...
        X