Learn R Programming

ggtime

The ggtime package extends the capabilities of ‘ggplot2’ by providing grammatical elements and plot helpers designed for visualizing time series patterns. These functions use calendar structures implemented in the mixtime package to help explore common time series patterns including trend, seasonality, cycles, and holidays.

The plot helper functions make use of the tsibble data format in order to quickly and easily produce common time series plots. These plots can also be constructed with the underlying grammar elements, which allows greater flexibility in producing custom time series visualisations.

Installation

You can install the stable version from CRAN:

install.packages("ggtime")

You can install the development version of ggtime from GitHub with:

# install.packages("remotes")
remotes::install_github("tidyverts/ggtime")

Example

The simplest time series visualisation is the time plot, which can be created with the autoplot() plot helper function on a tsibble object.

library(ggtime)
library(tsibble)
library(ggplot2)
tsibbledata::aus_production %>% 
  autoplot(Bricks)

To view the shape of the annual seasonal pattern, a seasonal plot created with gg_season() is commonly used. This makes it easier to identify the peaks, troughts, and overall shape of the seasonality.

tsibbledata::aus_production %>% 
  gg_season(Bricks)

Copy Link

Version

Install

install.packages('ggtime')

Monthly Downloads

854

Version

0.1.0

License

GPL (>= 3)

Maintainer

Mitchell O'Hara-Wild

Last Published

June 10th, 2025

Functions in ggtime (0.1.0)

gg_subseries

Seasonal subseries plots
gg_arma

Plot characteristic ARMA roots
gg_tsdisplay

Ensemble of time series displays
gg_lag

Lag plots
autoplot.dcmp_ts

Decomposition plots
gg_season

Seasonal plot
gg_tsresiduals

Ensemble of time series residual diagnostic plots
autoplot.tbl_ts

Plot time series from a tsibble
gg_irf

Plot impulse response functions
ggtime-package

ggtime: Grammar of Graphics and Plot Helpers for Time Series Visualization
reexports

Objects exported from other packages