plot_time_series: Function to plot time series data.

View source: R/plot_time_series.R

plot_time_seriesR Documentation

Function to plot time series data.

Description

Function to plot time series data.

Usage

plot_time_series(
  df,
  colour = "#FC4E07",
  facet_variable = NA,
  linewidth = 0.3,
  scales = "free_y",
  ylim = c(NA, NA),
  nrow = NULL,
  ncol = NULL
)

Arguments

df

Input data frame with at least two variables, two of which are named value and date.

colour

Colour of line geometry or which variable in df to code for colour.

facet_variable

Variable in df to facet the plot.

linewidth

Size/width of line geometry.

scales

Should scales be fixed ("free_y", the default), "fixed", free ("free"), or free in the x-dimension ("free_x", "free_y")?

ylim

Limits for y-axes.

nrow, ncol

When using facet_variable, how many rows and columns should be used?

Value

ggplot2 plot.

Author(s)

Stuart K. Grange

Examples


# Build data frame with correct variables
df <- data.frame(
  date = lubridate::ymd(c("2019-01-01", "2019-01-25"), tz = "UTC"),
  value = 1:2
)

# Plot
plot_time_series(df)


skgrange/threadr documentation built on May 11, 2024, 12:16 p.m.