Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: how to align the "baseline" (0) of 2 y axes?


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: how to align the "baseline" (0) of 2 y axes?
Date   Mon, 24 Oct 2011 00:28:25 +0100

You want two linear scales for which the zeros coincide. Thus one
scale is just proportional to the other, say scale_1 / scale_2 = b.
Best just to divide one scale by the other and fix the labels, e.g.
2000 "4000" 4000 "8000".

2011/10/23 László Sándor <[email protected]>:

> I am plotting bond and stock returns in Stata/SE 11.2 for Mac. Because
> stock return are on a different scale some years, I had to plot them
> against different y axes (and I could not even simply yscale(log) it
> as sometimes the market went down…). But if I simply call for two
> different y axes, the levels of zeros do not line up.
>
> twoway (tsline close_bonds close_mortgage, ytitle("%", axis(1)))
> (tsline return_close_stock, yaxis(2) ytitle("%", axis(2))), ///
>        legend(row(1) label(1 "Bonds") label(2 "Mortage bonds") label(3 "Stocks"))
>
> I know the graph will be somewhat confusing because of the scale
> change, but I would still keep the series in a single plot. How could
> I make the zero levels line up (i.e. coincide on both the left and
> right axis)?
>

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index