-------------------------------------------------------------------------------
help for tsgraph
-------------------------------------------------------------------------------

Time-series graph

tsgraph yvarlist [if exp] [in range] [ , graph_options nlabel(#) ]

Description

tsgraph plots one or more y variables against whatever tsset knows as the time variable. It is a convenience graph with options built-in to plot time series as connected lines. Data must have been tsset previously.

tsgraph looks for a panel variable and identifies distinct panels whenever there are no more than 4.

Remarks

Whenever

the time variable has a %t or %d format, and

neither xlabel nor xlabel() is specified, and

values span more than one year

tsgraph attempts to select for the time (x) axis nice labels based on the years included in the time series. For daily, weekly, monthly, quarterly or half-yearly data, it attempts to show the first time period within each of various years which are nice numbers. For yearly data, it attempts to show years which are nice numbers. Nice numbers here are preferably multiples of 10, 5 or 2. The main algorithm used is based on code by Hardin (1995).

Options

graph_options are options allowed with graph, twoway. Defaults are

connect(L), connect(LL[_]), connect(LL[_]L[-]), connect(LL[_]L[-]L[.]) for 1, 2, 3, 4 y variables

symbol is i for each y variable

xlabel ylabel gap(4)

l2title("(log scale)") if ylog

l1title shows variable label or variable name of single y variable.

nlabel(#) suggests the number of nice labels to be shown on the time axis. The suggestion may or may not be taken literally. This option is independent of xlabel or xlabel().

Examples

. tsset year

. tsgraph GDP*

Authors

Nicholas J. Cox, University of Durham, U.K. n.j.cox@durham.ac.uk Christopher F. Baum, Boston College baum@bc.edu

Acknowledgements

Alan Riley made a very helpful suggestion.

References

Hardin, J.W. 1995. Calculate nice numbers for labeling or drawing grid lines. Stata Technical Bulletin 25, 2-3. (Also in STB Reprints Volume 5, 19-20.)

Also see

On-line: help for graph, tsset, dfmt, tfmt