autoplot.ts

0th

Percentile

Automatically create a ggplot for time series objects

autoplot takes an object of type ts or mts and creates a ggplot object suitable for usage with stat_forecast.

fortify.ts takes a ts object and converts it into a data frame (for usage with ggplot2).

Usage
"autoplot"(object, ...) "autoplot"(object, facets=FALSE, ...) "fortify"(model,data, ...)
Arguments
object
Object of class “ts” or “mts”.
facets
If TRUE, multiple time series will be faceted. If FALSE, each series will be assigned a colour.
model
Object of class “ts” to be converted to “data.frame”.
data
Not used (required for fortify method)
...
Other plotting parameters to affect the plot.
Value

See Also

plot.ts, fortify

Aliases
  • autoplot.ts
  • fortify.ts
  • autoplot.mts
Examples
library(ggplot2)
autoplot(USAccDeaths)

lungDeaths <- cbind(mdeaths, fdeaths)
autoplot(lungDeaths)
autoplot(lungDeaths, facets=TRUE)
Documentation reproduced from package forecast, version 7.3, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.