Learn R Programming

ggtime (version 0.2.0)

autoplot.tbl_ts: Plot time series from a tsibble

Description

Produces a time series plot of one or more variables from a tsibble. If the tsibble contains a multiple keys, separate time series will be identified by colour.

Usage

# S3 method for tbl_ts
autoplot(object, .vars = NULL, ...)

# S3 method for tbl_ts autolayer(object, .vars = NULL, ...)

Value

A ggplot object showing a time plot of a time series.

Arguments

object

A tsibble.

.vars

A bare expression containing data you wish to plot. Multiple variables can be plotted using ggplot2::vars().

...

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

Examples

Run this code
if (FALSE) { # requireNamespace("tsibbledata", quietly = TRUE)
library(dplyr)
tsibbledata::gafa_stock %>%
 autoplot(vars(Close, log(Close)))
}

Run the code above in your browser using DataLab