Announcement

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

  • Plot three graphs into one diagram

    Dear all,


    Could someone tell me how it is possible with Stata to put three graphs into the same diagram? So far, I only achieved to create three independent diagrams that were simply plotted next to each other. However, I Want three different graphs in the same diagram.

    The x-axis will be the same for all graphs (a time variable) and the y-axis as well.

    I hope you could help me out on this!

    Best
    Bata

  • #2
    Take a look at -graph combine-.

    Comment


    • #3
      Hey Dimitri,

      thanks for your reply. I did take a look but could not put three different graphics into only one diagram. I did the following:

      line upper year_id, name(gr2)
      line lower year_id, name(gr3)
      graph combine gr2 gr3, iscale(1) graphr(margin(zero)) name(gr2and3)
      line _b_BM_decile1 year_id, fxsize(60) name(gr1)
      graph combine gr1 gr2and3, col(1)



      and also


      gr tw (line upper year_id, name(g1, replace) nodraw)
      gr tw (line lower year_id, name(g2, replace) nodraw)
      graph combine g1 g2, ycommon name(combined, replace)
      graph display combined, xsize(10)



      Hope you can help me out!

      Comment


      • #4
        it is not completely clear what you are asking for; Dimitriy's answer might or might not be what you want; maybe you want 3 lines on one graph? try the following:
        Code:
        . sysuse auto
        (1978 Automobile Data)
        
        . twoway (line price mpg if rep78==2, sort) (line price mpg if rep78==3, sort) (line price mpg if rep78==4, sort)

        Comment

        Working...
        X