Produces a faceted plot of the components used to build the response variable of the dable. Useful for visualising how the components contribute in a decomposition or model.

# S3 method for dcmp_ts
autoplot(object, .vars = NULL, scale_bars = TRUE, ...)

Arguments

object

A dable.

.vars

The column of the dable used to plot. By default, this will be the response variable of the decomposition.

scale_bars

If TRUE, each facet will include a scale bar which represents the same units across each facet.

...

Further arguments passed to ggplot2::geom_line(), which can be used to specify fixed aesthetics such as colour = "red" or size = 3.

Examples

if (requireNamespace("feasts", quietly = TRUE)) { library(feasts) library(tsibbledata) aus_production %>% model(STL(Beer)) %>% components() %>% autoplot() }
#> Warning: `units_since()` is deprecated as of tsibble 0.9.0. #> Please use `as.double()` instead. #> This warning is displayed once per session. #> Call `lifecycle::last_warnings()` to see where this warning was generated.
#> Error in if (any(f0 <- format == "")) { times <- unlist(unclass(x)[1L:3L])[f0] secs <- x$sec[f0] secs <- secs[!is.na(secs)] np <- getOption("digits.secs") np <- if (is.null(np)) 0L else min(6L, np) if (np >= 1L) for (i in seq_len(np) - 1L) if (all(abs(secs - round(secs, i)) < 1e-06)) { np <- i break } format[f0] <- if (all(times[!is.na(times)] == 0)) "%Y-%m-%d" else if (np == 0L) "%Y-%m-%d %H:%M:%S" else paste0("%Y-%m-%d %H:%M:%OS", np)}: missing value where TRUE/FALSE needed