
Last chance! 50% off unlimited learning
Sale ends in
monthplot(x, ...)
"monthplot"(x, labels = NULL, ylab = choice, choice = "seasonal", ...)
"monthplot"(x, labels = NULL, ylab = choice, choice = "sea", ...)
"monthplot"(x, labels = NULL, times = time(x), phase = cycle(x), ylab = deparse(substitute(x)), ...)
"monthplot"(x, labels = 1L:12L, ylab = deparse(substitute(x)), times = seq_along(x), phase = (times - 1L)%%length(labels) + 1L, base = mean, axes = TRUE, type = c("l", "h"), box = TRUE, add = FALSE, col = par("col"), lty = par("lty"), lwd = par("lwd"), col.base = col, lty.base = lty, lwd.base = lwd, ...)
stl
or StructTS
object?add = TRUE
)?"h"
is for histogram-like vertical lines.add = TRUE
?ts
, stl
, and
StructTS
methods use the internally recorded frequency and
start and finish times to set the scale and the seasons. The default
method assumes observations come in groups of 12 (though this can be
changed). If the labels
are not given but the phase
is given, then
the labels
default to the unique values of the phase
. If
both are given, then the phase
values are assumed to be indices
into the labels
array, i.e., they should be in the range
from 1 to length(labels)
.
ts
, stl
, StructTS
require(graphics)
## The CO2 data
fit <- stl(log(co2), s.window = 20, t.window = 20)
plot(fit)
op <- par(mfrow = c(2,2))
monthplot(co2, ylab = "data", cex.axis = 0.8)
monthplot(fit, choice = "seasonal", cex.axis = 0.8)
monthplot(fit, choice = "trend", cex.axis = 0.8)
monthplot(fit, choice = "remainder", type = "h", cex.axis = 0.8)
par(op)
## The CO2 data, grouped quarterly
quarter <- (cycle(co2) - 1) %/% 3
monthplot(co2, phase = quarter)
## see also JohnsonJohnson
Run the code above in your browser using DataLab