Title: | Plotting methods for hub models output |
---|---|
Description: | Plotting methods for hub models output. |
Authors: | Lucie Contamin [aut, cre] , Harry Hochheiser [ctb], Zhian Kamvar [ctb], Anna Krystalli [ctb], Nicholas G. Reich [ctb], Consortium of Infectious Disease Modeling Hubs [cph] |
Maintainer: | Lucie Contamin <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.1 |
Built: | 2024-11-20 19:19:38 UTC |
Source: | https://github.com/hubverse-org/hubVis |
Create a simple Plotly time-series plot for model projection outputs.
plot_step_ahead_model_output( model_out_tbl, target_data, use_median_as_point = FALSE, show_plot = TRUE, plot_target = TRUE, x_col_name = "target_date", x_target_col_name = "date", show_legend = TRUE, facet = NULL, facet_scales = "fixed", facet_nrow = NULL, facet_ncol = NULL, facet_title = "top left", interactive = TRUE, fill_by = "model_id", pal_color = "Set2", one_color = "blue", fill_transparency = 0.25, intervals = c(0.5, 0.8, 0.95), top_layer = "model_output", title = NULL, ens_color = NULL, ens_name = NULL, group = NULL )
plot_step_ahead_model_output( model_out_tbl, target_data, use_median_as_point = FALSE, show_plot = TRUE, plot_target = TRUE, x_col_name = "target_date", x_target_col_name = "date", show_legend = TRUE, facet = NULL, facet_scales = "fixed", facet_nrow = NULL, facet_ncol = NULL, facet_title = "top left", interactive = TRUE, fill_by = "model_id", pal_color = "Set2", one_color = "blue", fill_transparency = 0.25, intervals = c(0.5, 0.8, 0.95), top_layer = "model_output", title = NULL, ens_color = NULL, ens_name = NULL, group = NULL )
model_out_tbl |
a |
target_data |
a |
use_median_as_point |
a |
show_plot |
a |
plot_target |
a |
x_col_name |
column name containing the date information for |
x_target_col_name |
column name containing the date information for
|
show_legend |
a |
facet |
a unique value corresponding as a task_id variable name (interpretable as facet option for ggplot) |
facet_scales |
argument for scales as in ggplot2::facet_wrap or
equivalent to |
facet_nrow |
a numeric, number of rows in the layout. |
facet_ncol |
a numeric, number of columns in the layout (ignored in plotly::subplot) |
facet_title |
a |
interactive |
a |
fill_by |
name of a column for specifying colors and legend in plot.
The |
pal_color |
a |
one_color |
a |
fill_transparency |
numeric value used to set transparency of intervals.
0 means fully transparent, 1 means opaque. Default to |
intervals |
a vector of |
top_layer |
character vector, where the first element indicates the top
layer of the resulting plot. Possible options are |
title |
a |
ens_color |
a |
ens_name |
a |
group |
column name for partitioning the data in the data according the the value in the column. Please refer to ggplot2::aes_group_order for more information. By default, NULL (no partitioning). |
# Load and Prepare Data # The package hubExmaple contains example files, please consult the # documentation associated with the package, for more information. library(hubExamples) head(scenario_outputs) head(scenario_target_ts) projection_data <- dplyr::mutate(scenario_outputs, target_date = as.Date(origin_date) + (horizon * 7) - 1) projection_data <- dplyr::filter(projection_data, scenario_id == "A-2021-03-05", location == "US") projection_data <- hubUtils::as_model_out_tbl(projection_data) target_data_us <- dplyr::filter(scenario_target_ts, location == "US", date < min(projection_data$target_date) + 21, date > "2020-10-01") # Plot plot_step_ahead_model_output(projection_data, target_data_us)
# Load and Prepare Data # The package hubExmaple contains example files, please consult the # documentation associated with the package, for more information. library(hubExamples) head(scenario_outputs) head(scenario_target_ts) projection_data <- dplyr::mutate(scenario_outputs, target_date = as.Date(origin_date) + (horizon * 7) - 1) projection_data <- dplyr::filter(projection_data, scenario_id == "A-2021-03-05", location == "US") projection_data <- hubUtils::as_model_out_tbl(projection_data) target_data_us <- dplyr::filter(scenario_target_ts, location == "US", date < min(projection_data$target_date) + 21, date > "2020-10-01") # Plot plot_step_ahead_model_output(projection_data, target_data_us)