plot.epinowcast: Plot method for epinowcast

View source: R/methods.R

plot.epinowcastR Documentation

Plot method for epinowcast

Description

plot method for class "epinowcast".

Usage

## S3 method for class 'epinowcast'
plot(
  x,
  latest_obs = NULL,
  type = c("nowcast", "posterior_prediction"),
  log = FALSE,
  ...
)

Arguments

x

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

latest_obs

A data.frame of observed data which may be passed to lower level methods.

type

Character string indicating the plot required; enforced by base::match.arg(). Currently supported options:

  • "nowcast" which plots the nowcast for each dataset along with latest available observed data using enw_plot_nowcast_quantiles(),

  • "posterior_prediction" which plots observations reported at the time against simulated observations from the model using enw_plot_pp_quantiles().

log

Logical, defaults to FALSE. Should counts be plot on the log scale.

...

Additional arguments to the plot function specified by type.

Value

ggplot2 object

See Also

Other epinowcast: epinowcast(), summary.epinowcast()

Plotting functions enw_plot_nowcast_quantiles(), enw_plot_obs(), enw_plot_pp_quantiles(), enw_plot_quantiles(), enw_plot_theme()

Examples

nowcast <- enw_example("nowcast")
latest_obs <- enw_example("obs")

# Plot nowcast
plot(nowcast, latest_obs = latest_obs, type = "nowcast")

# Plot posterior predictions by reference date
plot(nowcast, type = "posterior_prediction") +
 ggplot2::facet_wrap(ggplot2::vars(reference_date), scales = "free")

seabbs/epinowcast documentation built on Sept. 20, 2024, 2:39 a.m.