forecast (version 7.0)

autoplot.ts: Automatically create a ggplot for time series objects

Description

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

## S3 method for class 'ts':
autoplot(object, ...)
## S3 method for class 'mts':
autoplot(object, ...)
## S3 method for class 'ts':
fortify(model,data, ...)

Arguments

object
Object of class ts or mts.
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

  • None. Function produces a ggplot graph.

See Also

plot.ts, fortify

Examples

Run this code
library(ggplot2)
autoplot(USAccDeaths)

lungDeaths <- cbind(mdeaths, fdeaths)
autoplot(lungDeaths)

Run the code above in your browser using DataLab