Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

tsplot

Time Series Plot


Description

Produces a nice plot of univariate or multiple time series in one easy line.

Usage

tsplot(x, y=NULL, main=NULL, ylab=NULL, xlab='Time', type=NULL, 
        margins=.25, ncolm=1, byrow=TRUE, minor=TRUE, nxm=2, nym=2,   
        col=1, gg=FALSE, ...)

Arguments

x, y

time series to be plotted; if both present, x will be the time index.

main

add a plot title - the default is no title.

ylab

y-axis label - the default is the name of the ts object.

xlab

x-axis label - the default is 'Time'.

type

type of plot - the default is line.

margins

inches to add (or subtract) to the margins.

ncolm

for multiple time series, the number of columns to plot.

byrow

for multiple time series - if TRUE (default), plot series row wise; if FALSE, plot series column wise.

minor, nxm, nym

if minor=TRUE, the number of minor tick marks on x-axis, y-axis. minor=FALSE removes both or set either to 0 or 1 to remove.

col

line color(s), can be a vector for multiple time series.

gg

if TRUE, the plots have gray interiors with white grids (like a ggplot); default is FALSE

...

other graphical parameteres; see par.

Author(s)

D.S. Stoffer

References

Examples

tsplot(soi, col=4, main="Southern Oscillation Index")
#
tsplot(1:453, soi, ylab='SOI', xlab='Month')
#
tsplot(climhyd, ncolm=2, gg=TRUE, col=rainbow(6,v=.8), lwd=2)

astsa

Applied Statistical Time Series Analysis

v1.12
GPL-3
Authors
David Stoffer
Initial release
2020-12-20

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.