Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[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 <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: how to align the "baseline" (0) of 2 y axes?
Date   Mon, 24 Oct 2011 08:36:22 +0100

1. What you ask is graphically equivalent to expressing both series
indexed so that at some base date they have the same index value.

2. Two separate graphs that are short and wide with aligned dates
might work as well or better. Many erratic time series benefit from
such a graph shape: William S. Cleveland's 1993 and 1994 books
(references in [G] and within

http://www.stat.purdue.edu/~wsc/papersbooks.pdf

give many examples.

Nick



On Mon, Oct 24, 2011 at 12:28 AM, Nick Cox <njcoxstata@gmail.com> wrote:
> 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 <sandorl@gmail.com>:
>
>> 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index