tsplot(..., type="l", lty=1:5, pch=<<see below>>, col=1:4) tspoints(..., type="p", lty=1:5, pch=<<see below>>, col=1:4) tslines(..., type="l", lty=1:5, pch=<<see below>>, col=1:4)
p
,
l
,
b
,
o
,
n
,
h
},
telling which type of plot
(points, lines, both, overlaid, none or high-density) should be done
for each plot. The first character of type defines the
first plot, the second character the second, etc.
Characters in
type
are used cyclically; e.g.,
"pl"
alternately plots
points and lines.
"p"
, the second for the
second, etc. The default is the digits (1 through 9, 0) then
the lower case letters.
To mix special plotting symbols (those specified by integers) and plotting
characters, either use character escapes
pch="X 02"
or figure out
the numeric equivalent of the ASCII character,
pch=c(88,2)
.
tsplot
generates a new plot;
tspoints
and
tslines
add to the
current plot.
Missing values are not plotted and lines that have an endpoint that is
missing are not drawn.
Note that all series are assumed to be in the same units.
Because plotting symbols are drawn with lines and because these functions
may be changing the line style, you should probably specify
lty=1
when using plotting symbols.
The commands
xaxs="d"
and
yaxs="d"
must be specified in a call to
par
rather than as arguments to
tsplot
.
Remember to release the direct axis afterwards.
Time series created by
ts
have been superseded by the classed time
series created by
rts
,
cts
, and
its
. You can coerce a old-style
time series to a new with
as.rts
.
The new plotting functions for time series are
ts.plot
,
ts.lines
and
ts.points
.
tsplot(hstart, smooth(hstart), type="pl") title(main="Housing Starts", sub="Data and Smoothed Values") sun.agg <- aggregate(sunspots, 1, "mean") par(mar=rep(5, 4)) tsplot(rain.nyc2, ylab="rain in inches") legend(1910, 57, c("rain", "sunspots"), lty=1:2) par(new=T) # trick to add plot with different scale tsplot(window(sun.agg, start(rain.nyc2), end(rain.nyc2)), axes=F, lty=2) axis(4) mtext("mean number of sunspots", side=4, line=3) title(main="New York Rainfall and Sunspot Activity")