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

st: RE: RE: Tsgraph with multiple y axis

From   "Nick Cox" <>
To   <>
Subject   st: RE: RE: Tsgraph with multiple y axis
Date   Sun, 11 Oct 2009 18:42:44 +0100

Martin gives good advice here. However, the relationship between -tsgraph- and -tsline- is not so much that the latter is a more up-to-date version of the former. I've no evidence that StataCorp in writing -tsline- were consciously imitating or updating -tsgraph-. Rather, -tsgraph- is an old user-written program that has never been updated given the essentially overlapping aims of -tsline- and -xtline-. 


Martin Weiss

-tsgraph- sounds like you are using an old -version- of Stata? Note you are meant to disclose this from the FAQ. See , section 2.4., for more info (though I cannot access the archives today for some reason...)

The modern implementation is -tsline- which is a -twoway- and can thus be given a second axis...

set obs 100

gen x=1
gen x1=3+.6*x[_n-1] + /*
*/ rnormal() in 2/l
gen x2=5+.6*x[_n-1] + /*
*/ rnormal() in 2/l
gen x3=50+.6*x[_n-1] + /*
*/ rnormal() in 2/l

gen time=_n
tsset time
twoway (tsline x1) (tsline x2)/*
*/  (tsline x3, yaxis(2))

Abhijit Sen Gupta

  I have three variables y1var y2var and y3var that I want to plot against time (in years). y3var has a very different scale than y1var or y2var so I was thinking if plotting it on a second y axis on the right with y1var and y2var on the left y axis. Is there a way of doing this using tsgraph?

*   For searches and help try:

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