plotMultiTS {QRMlib}R Documentation

Plot Multiple Time Series

Description

Plots multiple timeSeries objects on the same graph. Use this function if the plot.timeSeries() method from fCalendar returns the error “Error in xy.coords(x, y, xlabel, ylabel, log) :”
“‘x’ and sQuote{y} lengths differ”

Usage

plotMultiTS(tS, colvec = 1:ncol(tS), type = "l", ltypvec = 1, lwdvec = 1, yrange, format, at, reference.grid, ...)

Arguments

tS a timeSeries object with multiple data columns
colvec By default all columns will be used.
Use eqn{colvec = c(1,3)} to use only columns 1 and 3
type the typical types for plot functions: defaults to lines
ltypvec the typical types for lines in plots; For example 1=solid
and 2=dashed. Will be expanded to a vector for columns selected.
lwdvec the typical line-width for lines in plots.
yrange the maximum and minimum values to appear on the y-axis of the plot
format desired format for the date labels on x axis (defaults to year only)
at the parameter for an axis.POSIXct call. Use only if you know the start and end dates and want a more granular set of labels on the x-axis than the default will provide.
reference.grid set to TRUE if you want vertical and horizontal grid lines added to plot
... Any additional parameters to pass to plot (such as par parameters)

See Also

timeSeriesClass

Examples

data(DJ);
Sdata <- window(DJ, from="1993-01-01", to="2000-12-31");
#select only 4 stocks from 30-stock index:
tsSelections <- c("GE","INTC","KO","JNJ");
Sdata <- Sdata[,tsSelections];
Zdata <- log(Sdata);
rm(Sdata);
#Plot all 4 columns on same graph:
plotMultiTS(Zdata, reference.grid=TRUE);
#plot only columns 2 and 3 on the graph:
plotMultiTS(Zdata, colvec= c(2,3),reference.grid=TRUE, format="%Y-%m");

[Package QRMlib version 1.4.4 Index]