Skip to contents

plot method for class "fv_posterior". This function wraps all lower level plot functions.

Usage

# S3 method for fv_posterior
plot(
  x,
  obs = NULL,
  type = "cases",
  forecast_dates = NULL,
  central = FALSE,
  all_obs = FALSE,
  voc_label = "variant of concern",
  ...
)

Arguments

x

A data.table of output as produced by fv_tidy_posterior().

obs

A data frame of observed data as produced by latest_obs().

type

A character string indicating the type of plot required, defaulting to "cases". Current options are: "cases" which calls plot_cases(), "voc_frac" which calls plot_voc_frac(), "voc_advantage" which calls plot_voc_advantage(), "growth" which calls plot_growth(), "rt" which calls plot_rt(), and "all" which produces a list of all plots by call plot_posterior().

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.

central

Logical, defaults to FALSE. Should the mean and median central estimates be plot as dashed and solid lines respectively. Requires mean and median variables to be present in the input.

all_obs

Logical, defaults to FALSE. Should all observations be plot or just those in the date range of the estimates being plot.

voc_label

Character string giving the name to assign to the variant of concern. Defaults to "variant of concern".

...

Pass additional arguments to lower level plot functions.

Value

ggplot2 object

Examples

posterior <- fv_example(strains = 2, type = "posterior")

# plot cases on the log scale
plot(posterior, type = "cases", log = TRUE)


# plot cases with central estimates
plot(posterior, type = "cases", log = FALSE, central = TRUE)


# plot fraction that have the variant of concern
plot(posterior, type = "voc_frac")


# plot the transmission advantage for the the variant of concern
plot(posterior, type = "voc_advantage")


# plot the growth rates for both voc and non-voc cases
plot(posterior, type = "growth")


# plot the reproduction number estimates
plot(posterior, type = "rt")