| 1 |
\name{p.ts} |
| 2 |
\alias{p.ts} |
| 3 |
\title{plot.ts with multi-plots and Auto-Title -- on 1 page} |
| 4 |
\description{ |
| 5 |
For longer time-series, it is sometimes important to spread the |
| 6 |
time-series plots over several subplots. |
| 7 |
p.ts(.) does this both automatically, and under manual control. |
| 8 |
|
| 9 |
Actually, this is a generalization of \code{\link{plot.ts}} |
| 10 |
(with different defaults). |
| 11 |
} |
| 12 |
\usage{ |
| 13 |
p.ts(x, nrplots = max(1, min(8, n \%/\% 400)), overlap = nk \%/\% 16, |
| 14 |
date.x = NULL, do.x.axis = !is.null(date.x), do.x.rug = FALSE, |
| 15 |
ax.format, main.tit = NULL, ylim = NULL, ylab = "", xlab = "Time", |
| 16 |
quiet = FALSE, mgp = c(1.25, .5, 0), \dots) |
| 17 |
} |
| 18 |
\arguments{ |
| 19 |
\item{x}{timeseries (possibly multivariate) or numeric vector.} |
| 20 |
\item{nrplots}{number of sub-plots. Default: in \{1..8\}, |
| 21 |
approximately \code{n/400} if possible.} |
| 22 |
\item{overlap}{by how much should subsequent plots overlap. Defaults |
| 23 |
to about 1/16 of sub-length on each side.} |
| 24 |
\item{date.x}{a time \dQuote{vector} of the same length as \code{x} |
| 25 |
and coercable to class \code{"POSIXct"} (see \link{DateTimeClasses}).} |
| 26 |
\item{do.x.axis}{logical specifying if an x axis should be drawn |
| 27 |
(i.e., tick marks and labels).} |
| 28 |
\item{do.x.rug}{logical specifying if \code{\link{rug}} of |
| 29 |
\code{date.x} values should drawn along the x axis.} |
| 30 |
\item{ax.format}{when \code{do.x.axis} is true, specify the |
| 31 |
\code{format} to be used in the call to \code{\link{axis.POSIXct}}.} |
| 32 |
\item{main.tit}{\bold{Main} title (over all plots). Defaults to name |
| 33 |
of \code{x}.} |
| 34 |
\item{ylim}{numeric(2) or NULL; if the former, specifying the y-range |
| 35 |
for the plots. Defaults to a common pretty range.} |
| 36 |
\item{ylab, xlab}{labels for y- and x-axis respectively, see |
| 37 |
description in \code{\link{plot.default}}.} |
| 38 |
\item{quiet}{logical; if \code{TRUE}, there's no reporting on each subplot.} |
| 39 |
\item{mgp}{numeric(3) to be passed to \code{\link{mult.fig}()}, see |
| 40 |
\code{\link{par}(mgp = .)}.} |
| 41 |
\item{\dots}{further graphic parameters for each \code{\link{plot.ts}(..)}.} |
| 42 |
} |
| 43 |
\section{Side Effects}{ |
| 44 |
A page of \code{nrplots} subplots is drawn on the current |
| 45 |
graphics device. |
| 46 |
} |
| 47 |
\author{Martin Maechler, \email{[email protected]}; July 1994 (for S).} |
| 48 |
\seealso{\code{p.ts()} calls \code{\link{mult.fig}()} for setup. |
| 49 |
Further, \code{\link{plot.ts}} and \code{\link{plot}}. |
| 50 |
} |
| 51 |
\examples{ |
| 52 |
stopifnot(require(stats)) |
| 53 |
## stopifnot(require(datasets)) |
| 54 |
|
| 55 |
data(sunspots) |
| 56 |
p.ts(sunspots, nr=1) # == usual plot.ts(..) |
| 57 |
p.ts(sunspots) |
| 58 |
p.ts(sunspots, nr=3, col=2) |
| 59 |
|
| 60 |
data(EuStockMarkets) |
| 61 |
p.ts(EuStockMarkets[,"SMI"]) |
| 62 |
## multivariate : |
| 63 |
p.ts(log10(EuStockMarkets), col = 2:5) |
| 64 |
|
| 65 |
## with Date - x-axis (dense random dates): |
| 66 |
set.seed(12) |
| 67 |
x <- as.Date("2000-02-29") + cumsum(1+ rpois(1000, lambda= 2.5)) |
| 68 |
z <- cumsum(.1 + 2*rt(1000, df=3)) |
| 69 |
p.ts(z, 4, date.x = x) |
| 70 |
p.ts(z, 6, date.x = x, ax.format = "\%b \%Y", do.x.rug = TRUE) |
| 71 |
} |
| 72 |
\keyword{hplot} |
| 73 |
\keyword{ts} |