Learn R Programming

Boom (version 0.9.15)

plot.many.ts: Multiple time series plots

Description

Plots many time series plots on the same graphical device. Each plot gets its own frame. Scales can be adjusted to see variation in each plot (each plot gets its own scale), or variation between plots (common scale).

Usage

PlotManyTs(x, type = "l", gap = 0, boxes = TRUE, truth = NULL,
           thin = 1, labs, same.scale = TRUE, ylim = NULL,
           refline = NULL, color = NULL, ...)

Arguments

x

Matrix, data frame, list, or 3-dimensional array to be plotted.

type

type of line plots to produce. See plot.default for other options.

gap

Number of lines of space to put between plots.

boxes

Logical indicating whether boxes should be drawn around each plot.

truth

A vector or matrix of reference values to be added to each plot as a horizontal line. The dimension should match dim(x)[-1]

thin

Frequency of observations to plot. E.g. thin=10 means plot every 10'th observation. Thinning can speed things up when plotting large amounts MCMC output.

labs

Optional character vector giving the title (e.g. variable name) for each plot. If labs is missing then column names or dimnames will be used to label the plots. If labs is NULL then no labels will be used.

same.scale

Logical indicating whether plots should be drawn with a common vertical axis, which is displayed on alternating rows of the plot. If FALSE then the vertical axis of each plot is scaled to the range of data in that plot, but no tick marks are displayed.

ylim

Scale of the vertical axis. If non-NULL then same.scale is set to TRUE and the supplied scale is used for all plots.

refline

a vector or scalar value to use as a reference line. This is a supplement to the truth argument. It can be useful when comparing true values (used in a simulation), estimated values (e.g. point estimates of parameters) and MCMC output.

color

Vector of colors to use in the plots.

...

Extra arguments passed to plot and axis.

Author

Steven L. Scott

See Also

plot.ts (for plotting a small number of time series) plot.macf

Examples

Run this code

x <- matrix(rnorm(1000), ncol = 10)
PlotManyTs(x)
PlotManyTs(x, same = FALSE)

Run the code above in your browser using DataLab