Calendar Time Series Plot

DESCRIPTION:

Function to plot a calendar time series. This is the method for the plot function for class timeSeries, and it can also be called directly.

USAGE:

plot.timeSeries(x, ..., main=x@title, ylab=x@units[1],
                 top.ticks=F, right.ticks=F, left.ticks=T,
                 reference.grid=T, plot.type="lines",
                 merge.args=list(pos="union", how="interp"),
                 x.axis.args=list(), y.axis.args=list(),
                 plot.args=list(), log.axes="c", complex.convert=Mod,
                 frame=sys.nframe())

REQUIRED ARGUMENTS:

x
a univariate or multivariate calendar time series object or a list of calendar time series objects.

OPTIONAL ARGUMENTS:

...
additional calendar time series objects can be passed as unnamed arguments immediately following the x argument. These time series will also be plotted. You can also pass in additional plotting arguments such as xlim and other par parameters.
main
main title for the plot.
ylab
y-axis title for the plot (note that only the first element is used).
top.ticks
if TRUE, tick marks are placed on the top axis as well as the bottom axis.
right.ticks
if TRUE, tick marks are placed on the right axis.
left.ticks
if TRUE, tick marks are placed on the left axis.
reference.grid
if TRUE, a reference grid is superposed on the plot. The reference grid lines can be modified using the minor.grid and major.grid elements of the trellis parameter list; for example, trellis.par.set("minor.grid", list(col=14, lty=3, lwd=3)).
plot.type
a character string indicating the type of plot. Possible values are "lines", "hloc", and "stackbar" for plotting lines/points, high-low-open-close bars, and stacked bars respectively.
merge.args
a list of parameters to pass to the seriesMerge function for merging time series passed through x and ... into a single time series.
x.axis.args
a list of parameters to pass to the axis.time function for customizing the time axis.
y.axis.args
a list of parameters to pass to the axis.numeric function for customizing the y-axis.
plot.args
a list of parameters to pass to the plot functions lines.render, hloc.render, and stackbar.render.
log.axes
set to "y" to make the y-axis logarithmic. Any other value makes it linear.
complex.convert
function used to convert complex numbers to real for plotting.
frame
the frame in which to parse the ... arguments. This argument can be used when plot.timeSeries is called from within another function if the plot titles are not coming out correctly.

VALUE:

the output of axis.time which has the parameters for the time axis, including the mapping from user coordinates to plot coordinates. This is needed to add to the plot or identify points from the plot.

SIDE EFFECTS:

A plot will be produced on the active device. It will look its best if a Trellis device is used. To control the layout of the axes and reference grid lines, as well as other style parameters, use the functions trellis.par.get and trellis.par.set.

SEE ALSO:

, , , , , , .

EXAMPLES:

## plot the Dow Jones Industrial Average around the '87 crash
djia1 <-djia[positions(djia)>=timeDate("09/01/87") &
             positions(djia)<=timeDate("11/01/87"), 1:4]
plot.timeSeries(djia1, plot.type="hloc")
## plot high-low Treasury bond futures
tbond1 <- tbond[positions(tbond)>=timeDate("02/01/94") &
             positions(tbond)<=timeDate("02/13/94"),]
plot.timeSeries(tbond1, plot.type="hloc")
## plot average 3-month, 6-month, 1 year T-Bill rates
##    by default, the lines are interpolated between observations
tbauc.3m1 <- tbauc.3m[positions(tbauc.3m)>=timeDate("01/01/96") &
             positions(tbauc.3m)<=timeDate("07/01/97"),]
tbauc.6m1 <- tbauc.6m[positions(tbauc.6m)>=timeDate("01/01/96") &
             positions(tbauc.6m)<=timeDate("07/01/97"),]
tbauc.1y1 <- tbauc.1y[positions(tbauc.1y)>=timeDate("01/01/96") &
             positions(tbauc.1y)<=timeDate("07/01/97"),]
plot.timeSeries(tbauc.3m1,tbauc.6m1,tbauc.1y1)
## plot again, but don't interpolate & use points
plot.timeSeries(tbauc.3m1,tbauc.6m1,tbauc.1y1,
                 merge.args=list(pos="union"),
                 plot.args=list(type="p"))
## plot the size of network packets
net.pack1 <- net.packet[net.packet[,1]=="TCP",2]
plot.timeSeries(net.pack1[1:1000])