Plot the posterior prediction for cases
Usage
plot_cases(
posterior,
obs = NULL,
forecast_dates = NULL,
all_obs = FALSE,
central = FALSE,
col = NULL,
log = TRUE
)
Arguments
- posterior
A dataframe of posterior output as produced by
fv_tidy_posterior()
. For forecast dates to be extracted data withvalue_type == "cases"
must be present.- obs
A data frame of observed data as produced by
latest_obs()
.- forecast_dates
A data.frame in the format produced by
extract_forecast_dates()
(with at least a date variable and a Data unavailable variable)). Specifies when date availability should be add to plots. May contain faceting variables.- all_obs
Logical, defaults to
FALSE
. Should all observations be plot or just those in the date range of the estimates being plot.- central
Logical, defaults to FALSE. Should the mean and median central estimates be plot as dashed and solid lines respectively. Requires
mean
andmedian
variables to be present in the input.- col
A character string denoting the variable to use to stratify the ribbon plot. Defaults to "type" which indicates the data stream.
- log
Logical, defaults to
TRUE
. Should cases be plot on the log 2 scale?
See also
Plotting functions
add_forecast_dates()
,
plot.fv_forecast()
,
plot.fv_posterior()
,
plot_default()
,
plot_growth()
,
plot_pairs()
,
plot_posterior()
,
plot_rt()
,
plot_theme()
,
plot_voc_advantage()
,
plot_voc_frac()
,
save_plots()
Examples
posterior <- fv_example(strains = 2, type = "posterior")
# default with log transform
plot_cases(posterior)
# without log transform
plot_cases(posterior, log = FALSE)