RE: st: RE: Graph twoway: Multiple axis and order of plots

 From "Thuy Le" To Subject RE: st: RE: Graph twoway: Multiple axis and order of plots Date Fri, 07 Jul 2006 09:02:02 -0400

```I think the order of the graphs matter here. If you put the bar graph after
the line graph, the bar graph will be on top of the line. I used your own
example to produce a different result:

sysuse auto,clear
gen t = _n
twoway line gear t, lc(blue) lw(medthick) yaxis(1) ///
|| bar trunk t, bc(gs12) yaxis(2) ||, ///
ylabel(5 "2.00" 10 "2.50" 15 "3.00" 20 "3.50" 25 "4.00" , axis(2)) ///
ytitle(Gear Ratio, axis(2)) ///
ylabel(2 "5" 2.5 "10" 3 "15" 3.5 "20" 4 "25", axis(1)) ///  ytitle(Trunk
space (cu. ft.), axis(1))

Thuy

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Scott Merryman
Sent: Friday, July 07, 2006 7:16 AM
To: statalist@hsphsun2.harvard.edu
Subject: RE: st: RE: Graph twoway: Multiple axis and order of plots

If I am following this thread correctly, it appears that the only way to
draw a line plot on top of bar plot, with the y-axis for the line plot on
the left, is to -ytitle- and -ylabel- the left and right y-axes by hand:

sysuse auto,clear
gen t = _n
twoway bar trunk t, bc(gs12) yaxis(2) ///
|| line gear t, lc(blue) lw(medthick) yaxis(1)  ||, ///
ylabel(5 "2.00" 10 "2.50" 15 "3.00" 20 "3.50" 25 "4.00" , axis(2)) ///
ytitle(Gear Ratio, axis(2)) ///
ylabel(2 "5" 2.5 "10" 3 "15" 3.5 "20" 4 "25", axis(1)) ///  ytitle(Trunk
space (cu. ft.), axis(1))

Scott

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```