Plots for describing time series data.
DayPlot(y, colors = NULL, ylab = NULL, ...)
MonthPlot(y, seasonal.identifier = months, colors = NULL, ylab = NULL, ...)
YearPlot(y, colors = NULL, ylab = NULL, ylim = NULL, legend = TRUE, ...)
Returns invisible{NULL}
.
A time series to plot. Must be of class ts
, or
zoo
. If a zoo object then the timestamps must be of
type Date
, yearmon
, or POSIXt
.
A function that takes a vector of class POSIXt
(date/time) and returns a character vector indicating the season to
which each element belongs. Each unique element returned by this
function returns a "season" to be plotted. See
weekdays
, months
,
and quarters
for examples of how this should work.
A vector of colors to use for the lines.
Logical. If TRUE
then a legend is added to the plot.
Label for the vertical axis.
Limits for the vertical axis. (a 2-vector)
DayPlot
and MonthPlot
plot the time series one season at
a time, on the same set of axes. The intent is to use DayPlot for
daily data and MonthPlot for monthly or quarterly data.
YearPlot
plots each year of the time series as a separate line
on the same set of axes.
Both sets of plots help visualize seasonal patterns.
## Plot a 'ts' time series.
data(AirPassengers)
par(mfrow = c(1,2))
MonthPlot(AirPassengers)
YearPlot(AirPassengers)
## Plot a 'zoo' time series.
data(turkish)
par(mfrow = c(1,2))
YearPlot(turkish)
DayPlot(turkish)
Run the code above in your browser using DataLab