Announcement

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

  • handling 3 Y axes on twoway graphs (can I get two on the left/one on the right?)?

    I'm trying to graph three y axis variables (clinical parameters) that have different scales, with time on the x axis. on a twoway graph. If I do just two Y axes I can get one to appear on the left and one on the right, but with three it appears the only option is to have them all stacked on the left. I've searched through Statalist, google, and VGSG (Mitchell's excellent book), and haven't found a solution. Is there a way (perhaps a user written ado file) to get two axes on the left and one on the right? With three axes stacked together on the left it is hard to read the axis labels and scales even with smaller fonts and larger gaps. I've been setting this up along these lines:
    ------------------------------------------------
    twoway (connect y1 time, sort yaxis(1) ylabel(,axis(1))) ///
    (connect y2 time, sort yaxis(2) ylabel(1 (1) 5, axis(2))) ///
    (connect y3 time, sort yaxis(3) ylabel(100 (200) 1000, axis(3)))
    ----------------------------------------------------------
    Does anyone know a way to force one of the three axes to appear on the right hand side of the graph when there are three axes?


    wendy

  • #2
    The y axis scale can be placed to the right of the graph using the yscale() option with the suboptions alt and axis(). An example appears below.

    Code:
    . sysuse auto
    . scatter mpg trunk, yaxis(1) ylabel(, axis(1))       ||                  ///
        scatter turn trunk, yaxis(2) ylabel(, axis(2))    ||                  ///
        scatter weight trunk, yaxis(3) ylabel(, axis(3))                      ///
                yscale(axis(3) alt)

    Comment

    Working...
    X