\Header{monthplot}{Plot a Seasonal or other Subseries}
\methalias{monthplot.default}{monthplot}
\methalias{monthplot.stl}{monthplot}
\methalias{monthplot.StructTS}{monthplot}
\methalias{monthplot.ts}{monthplot}
\keyword{hplot}{monthplot}
\keyword{ts}{monthplot}
\begin{Description}\relax
These functions plot seasonal (or other) subseries of a time series.
For each season (or other category), a time series is plotted.
\end{Description}
\begin{Usage}
\begin{verbatim}
monthplot(x, labels = NULL, times, phase, base, choice, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] Time series or related object.
\item[\code{labels}] Labels to use for each \dQuote{season}.
\item[\code{times}] Time of each observation.
\item[\code{phase}] Indicator for each \dQuote{season}.
\item[\code{base}] Function to use for reference line for subseries.
\item[\code{choice}] Which series of an \code{stl} or \code{StructTS} object?
\item[\code{...}] Graphical parameters.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
These functions extract subseries from a time series and plot them
all in one frame.  The \code{\Link{ts}}, \code{\Link{stl}}, and
\code{\Link{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 \code{labels} are not given but the \code{phase} is given, then
the \code{labels} default to the unique values of the \code{phase}.  If
both are given, then the \code{phase} values are assumed to be indices
into the \code{labels} array, i.e., they should be in the range
from 1 to \code{length(labels)}.
\end{Details}
\begin{Value}
These functions are executed for their side effect of
drawing a seasonal subseries plot on the current graphical
window.
\end{Value}
\begin{Author}\relax
Duncan Murdoch
\end{Author}
\begin{References}\relax
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
\emph{The New S Language}.
Wadsworth \& Brooks/Cole.
\end{References}
\begin{SeeAlso}\relax
\code{\Link{ts}}, \code{\Link{stl}}, \code{\Link{StructTS}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
## The CO2 data
data(co2)
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
\end{ExampleCode}
\end{Examples}

