Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: AW: RE: axis(1) and axis(2) scales in graphs


From   Ulrich Kohler <[email protected]>
To   [email protected]
Subject   Re: st: AW: RE: axis(1) and axis(2) scales in graphs
Date   Tue, 26 Jan 2010 14:23:31 +0100

Am Dienstag, den 26.01.2010, 13:47 +0100 schrieb Martin Weiss:
> <> 
> 
> " I am not completely clear what the problem is"
> 
> 
> 
> Actually, I found the problem exceptionally clear in this case:
> 
> 
> *************
> clear*
> set seed 123456
> set obs 100
> gen time=_n
> gen serieA=rnormal()
> gen serieB=rnormal(1,2)
> tw (line serieA time, yaxis(1) yli(0)) (line serieB time, yaxis(2)) 
> *************
> 
> I just did not know how to align the zero point on the left and right axis,
> to be honest...


Perhaps something along this lines

-------------------------------------------

clear*
set seed 123456
set obs 100
gen time=_n
gen serie1=rnormal()
gen serie2=rnormal(1,2)

reshape long serie, i(time) j(nr)

sum serie

tw ///
 || line serie time if nr==1, yaxis(1) ///
 || line serie time if nr==2, yaxis(2) ///
 || , yscale(range(`=r(min)-1' `=r(max)+1') axis(1)) ///
      yscale(range(`=r(min)-1' `=r(max)+1') axis(2)) ///
      yline(0)     
-------------------------------------------------

Uli


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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