Skip to contents

Add a moving average time series line to an exiting ggplot plot object. Graphical choices were made to closely reflect plots generated with `LBoM::plot.LBoM`.

Usage

iidda_plot_ma(
  plot_object,
  data = NULL,
  series_variable = "deaths",
  time_variable = "period_end_date"
)

Arguments

plot_object

a `ggplot2` plot object

data

data frame containing moving average time series data, typically output from `iidda_prep_ma()`. If `NULL` data is inherited from `plot_object`

series_variable

column name of series variable in `data`, default is "deaths"

time_variable

column name of time variable in `data`, default is "period_end_date"

Value

a ggplot2 plot object containing a moving average time series