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

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(s)

Steven L. Scott

See Also

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

Examples

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

Boom

Bayesian Object Oriented Modeling

v0.9.7
LGPL-2.1 | file LICENSE
Authors
Steven L. Scott is the sole author and creator of the BOOM project. Some code in the BOOM libraries has been modified from other open source projects. These include Cephes (obtained from Netlib, written by Stephen L. Moshier), NEWUOA (M.J.D Powell, obtained from Powell's web site), and a modified version of the R math libraries (R core development team). Original copyright notices have been maintained in all source files. In these cases, copyright claimed by Steven L. Scott is limited to modifications made to the original code. Google claims copyright for code written while Steven L. Scott was employed at Google from 2008 - 2018, but BOOM is not an officially supported Google project.
Initial release
2021-02-15

We don't support your browser anymore

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