plot-methods {timeSeries} | R Documentation |
Plot 'timeSeries' objects and add lines and points to an already existing chart or graph.
## S4 method for signature 'timeSeries' plot(x, y, FinCenter = NULL, plot.type = c("multiple", "single"), format = "auto", at = pretty(x), widths = 1, heights = 1, xy.labels, xy.lines, panel = lines, nc, yax.flip = FALSE, mar.multi = c(0, 5.1, 0, if (yax.flip) 5.1 else 2.1), oma.multi = c(6, 0, 5, 0), axes = TRUE, ...) ## S4 method for signature 'timeSeries' lines(x, FinCenter = NULL, ...) ## S4 method for signature 'timeSeries' points(x, FinCenter = NULL, ...) ## S3 method for class 'timeSeries' pretty(x, n=5, min.n=n%/%3, shrink.sml=0.75, high.u.bias=1.5, u5.bias=0.5+1.5*high.u.bias, eps.correct=0, ...)
x,y |
objects of class |
FinCenter |
a character with the the location of the financial center
named as |
plot.type |
for multivariate time series, should the series by plotted separately (with a common time axis) or on a single plot? |
format |
POSIX label format, e.g. "%Y-%m-%d" or "%F" for ISO-8601 standard date format. |
at |
a |
widths, heights |
widths and heights for individual graphs, see |
xy.labels |
logical, indicating if |
xy.lines |
logical, indicating if |
panel |
a |
nc |
the number of columns to use when |
yax.flip |
logical indicating if the y-axis (ticks and numbering) should
flip from side 2 (left) to 4 (right) from series to series
when |
mar.multi, oma.multi |
the (default) |
axes |
logical indicating if x- and y- axes should be drawn. |
n |
an integer giving the desired number of intervals. |
min.n |
a nonnegative integer giving the minimal number of intervals. |
shrink.sml |
a positive numeric by a which a default scale is shrunk in the case when range(x) is very small. |
high.u.bias |
a non-negative numeric, typically > 1. Larger high.u.bias values favor larger units. |
u5.bias |
a non-negative numeric multiplier favoring factor 5 over 2. |
eps.correct |
an integer code, one of 0,1,2. If non-0, a correction is made at the boundaries. |
... |
additional graphical arguments, see |
a plot or plot elements of an object of class timeSeries
.
## Load Swiss Pension Fund Benchmark Data - LPP <- LPP2005REC[1:12, 1:4] colnames(LPP) <- abbreviate(colnames(LPP), 2) finCenter(LPP) <- "GMT" ## Example Plot 1 - plot(LPP[, 1], type = "o", col = "steelblue", main = "LPP", xlab = "2005", ylab = "Return") plot(LPP[, 1], at="auto", type = "o", col = "steelblue", main = "LPP", xlab = "2005", ylab = "Return") ## Example Plot 2 - plot(LPP[, 1:2], type = "o", col = "steelblue", main = "LPP", xlab = "2005", ylab = "Return") ## Example Plot 3 - plot(LPP[, 1], LPP[, 2], type = "p", col = "steelblue", main = "LPP", xlab = "Return 1", ylab = "Return 2") ## Example Plot 4a, The Wrong Way to do it! - LPP <- as.timeSeries(data(LPP2005REC)) ZRH <- as.timeSeries(LPP[,"SPI"], zone = "Zurich", FinCenter = "Zurich") NYC <- as.timeSeries(LPP[,"LMI"], zone = "NewYork", FinCenter = "NewYork") finCenter(ZRH) finCenter(NYC) plot(ZRH, at="auto", type = "p", pch = 19, col = "blue") points(NYC, pch = 19, col = "red") ## Example Plot 4b, Convert NYC to Zurich Time - finCenter(ZRH) <- "Zurich" finCenter(NYC) <- "Zurich" at <- unique(round(time(ZRH))) plot(ZRH, type = "p", pch = 19, col = "blue", format = "%b %d", at = at, xlab = paste(ZRH@FinCenter, "local Time"), main = ZRH@FinCenter) points(NYC, pch = 19, col = "red") ## Example 4c, Force Everything to GMT Using "FinCenter" Argument - finCenter(ZRH) <- "Zurich" finCenter(NYC) <- "NewYork" at <- unique(round(time(ZRH))) plot(ZRH, type = "p", pch = 19, col = "blue", format = "%b %d", at = at, FinCenter = "GMT", xlab = "GMT", main = "ZRH - GMT") points(NYC, FinCenter = "GMT", pch = 19, col = "red")