Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

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


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Graph twoway: Multiple axis and order of plots
Date   Thu, 6 Jul 2006 15:20:17 +0100

There is no concrete code to comment on here. 
I did this: 

. sysuse auto, clear 
(1978 Automobile Data)

. collapse mpg, by(rep78) 

. l

     +-----------------+
     | rep78       mpg |
     |-----------------|
  1. |     1        21 |
  2. |     2    19.125 |
  3. |     3   19.4333 |
  4. |     4   21.6667 |
  5. |     5   27.3636 |
     |-----------------|
  6. |     .      21.4 |
     +-----------------+

. twoway bar mpg rep78, yaxis(1 2) yla(18(2)28, axis(2)) 
|| line mpg rep78, yla(20 30, axis(1))

and the line plot is on top of the bar plot, and I have 
two separate axes. Does that help? 

Nick 
n.j.cox@durham.ac.uk 

Peter Uhrmacher
 
> it seems that I am unable to solve a rather simple problem... 
> but I hope 
> you can. What I would like to have is a "graph twoway" with a 
> line plot 
> and a bar plot. the line plot is supposed to use yaxis1, the 
> bar plot is 
> supposed to use yaxis2. at the same time, the bar plot is supposed to 
> appear in the background (so that the lines appear on top of it). 
> however, whatever I try it seems that the plots that use yaxis2 are 
> always put on top of the others that use yaxis1... (which in my case 
> means that the line plot is hidden behind the bars). Is there a 
> solution? I'm sure there is.

*
*   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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index