Add Plot Highlight
iidda_plot_highlight.Rd
Add a rectangular highlighted region to an existing ggplot2 plot object
Usage
iidda_plot_highlight(
plot_object,
data = NULL,
series_variable = "deaths",
time_variable = "period_end_date",
filter_variable = "period_end_date",
filter_start = "1700-01-01",
filter_end = "1800-01-01",
...
)
Arguments
- plot_object
a `ggplot2` plot object
- data
data frame containing time series data. If `NULL` data is inherited from `plot_object`. This has only been tested with data output from `iidda_plot_ma`.
- 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"
- filter_variable
column name of variable to filter on in `data`, default is "period_end_date"
- filter_start
value of `filter_variable` for starting range, default is "1700-01-01"
- filter_end
value of `filter_variable` for ending range, default is "1800-01-01"
- ...
other arguments to be passed to `ggforce::geom_mark_rect`, for example annotating with text