timeSeries
object on the current
plotting device. This function is the method for
trellisPlot
for objects of class
timeSeries
, but it can also be called
directly.
trellisPlot.timeSeries(x, ..., subset=T, xlab="", ylab=<<see below>>, plot.type=NULL, xlim=NULL, ylim=NULL, scales=NULL, x.axis.args=NULL, y.axis.args=NULL, log.axes="c", complex.convert=Mod, layout=NULL, trellis.args=NULL, frame.call=sys.nframe(), frame.function=frame.call)
x@units
or an empty string if
this is
NULL
.
"line"
,
"hloc"
, and
"stackbar"
for
plotting lines/points, high-low-open-close bars, and stacked bars respectively.
For stacked bar plots, the y-values given in the data represent
the cumulative heights of bars; e.g. if you want three stacked bars
of height 2, the y values should be 2, 4, and 6.
plot.type
may be a single character value, to use the same plot type for
everything; a vector as long as the number of series arguments, to
specify different plot types for each series; a list of length one to
use the same plot types for each series, but specify different plotting
types for the columns within the series; or a list as long as the
number of series, where each list is a vector specifying plot types
for each column in that series.
x
values to use for plotting.
y
values to use for plotting.
x
and
y
components for passing into the
scales
argument of
xyplot
. Typically, this is used to make the
x
or
y
axes for each panel have separate scales, by setting the
x
or
y
component of
scales
to
list(relation="free")
.
axis.time
function for customizing the x-axis.
axis.numeric
function for
customizing the y-axis.
c(2,3)
for a
two-row, three-column layout. If
NULL
, a layout that is as
nearly square as possible will be calculated using the
good.layout
function.
xyplot
trellis
plotting function; these can also be passed directly as part of
...
.
sys.call
and
deparse(substitute())
in to figure out data set names (passed to
parse.time.series.dotargs
) in parsing the
...
arguments.
sys.function
in to figure out the plot function
arguments (passed to
parse.time.series.dotargs
) in parsing the
...
arguments.
trellis
, which is automatically plotted
by
print.trellis
, using the
panel.timeSeries
panel function,
which calls
panel.stackbar
once per time series to render
stacked bar columns,
panel.hloc
once to render
hloc columns, and
panel.superpose
once to render line plot columns.
This function creates a Trellis plot of one or more time
series objects.
For each time series argument passed in the
x
or
...
arguments,
a single panel is created.
If a time series is multivariate, all of the columns are plotted
in the panel for that time series, typically with different line types
or colors.
Graphical arguments governing line type, color, and other
parameters for Trellis plots of time series should be set
using
trellis.par.set
. They are stored in the various
Trellis data sets for the plotting devices, and designed to
give good-looking plots with distinct styles for each column
of each data set.
# Plot high-low-close and volume for the djia time series in 1987 # Logical vector to select 1987 value: t1987.p <- positions(djia) > timeDate("1/1/1987") & positions(djia) < timeDate("1/1/1988") # The high-low-open-close values for 1987: Hi.Low.Open.Close <- djia[t1987.p, 1:4] # The volume for 1987: Daily.Volume <- djia[t1987.p, "volume"] # The plot: trellisPlot(Hi.Low.Open.Close, Daily.Volume, scales=list(y=list(relation="free")), plot.type=c("hloc", "stackbar"))