autolayer.mts

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.

Usage
# S3 method for mts
autolayer(object, colour = TRUE, series = NULL, ...)

# S3 method for msts autolayer(object, series = NULL, ...)

# S3 method for ts autolayer(object, colour = TRUE, series = NULL, ...)

# S3 method for ts autoplot(object, series = NULL, ...)

# S3 method for mts autoplot(object, colour = TRUE, facets = FALSE, ...)

# S3 method for msts autoplot(object, series = NULL, ...)

# S3 method for ts fortify(model, data, ...)

Arguments
object

Object of class “ts” or “mts”.

colour

If TRUE, the time series will be assigned a colour aesthetic

series

Identifies the timeseries with a colour, which integrates well with the functionality of geom_forecast.

...

Other plotting parameters to affect the plot.

facets

If TRUE, multiple time series will be faceted (and unless specified, colour is set to FALSE). 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)

Details

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

Value

None. Function produces a ggplot graph.

See Also

plot.ts, fortify

Aliases
  • autolayer.mts
  • autolayer.msts
  • autolayer.ts
  • autoplot.ts
  • autoplot.mts
  • autoplot.msts
  • fortify.ts
Examples
# NOT RUN {
library(ggplot2)
autoplot(USAccDeaths)

lungDeaths <- cbind(mdeaths, fdeaths)
autoplot(lungDeaths)
autoplot(lungDeaths, facets=TRUE)

# }
Documentation reproduced from package forecast, version 8.1, License: GPL (>= 3)

Community examples

Looks like there are no examples yet.