Skip to content

Commit

Permalink
Fixed miscellaneous plot warnings (#78)
Browse files Browse the repository at this point in the history
Fixes legends for figures 1 and 5
  • Loading branch information
lshandross committed May 31, 2024
1 parent ec6af96 commit 5f4f963
Show file tree
Hide file tree
Showing 12 changed files with 249 additions and 174 deletions.
Binary file modified analysis/paper/hubEnsembles_manuscript.pdf
Binary file not shown.
19 changes: 11 additions & 8 deletions analysis/paper/hubEnsembles_manuscript.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ hubExamples::forecast_outputs |>
) |>
dplyr::mutate(value=round(value, 2),
model_id = "model-X") |>
dplyr::select(abbr_fc_col) |>
dplyr::select(all_of(abbr_fc_col)) |>
dplyr::arrange(horizon) |>
knitr::kable(col.names = formatted_fc_col)
```
Expand All @@ -176,7 +176,7 @@ hubExamples::scenario_outputs |>
horizon == "26",
output_type_id %in% c(0.25, 0.5, 0.75)
) |>
dplyr::select(abbr_scn_col) |>
dplyr::select(all_of(abbr_scn_col)) |>
dplyr::mutate(model_id = "model-Y",
scenario_id = substr(scenario_id,1,1)) |>
knitr::kable(col.names = formatted_scn_col)
Expand Down Expand Up @@ -505,16 +505,16 @@ pc_fin <- cowplot::ggdraw(pc + theme(legend.position = "none")) +
)
# combine into final figure
l <- cowplot::get_legend(pa)
l2 <- cowplot::get_legend(pc)
l <- cowplot::get_plot_component(pa, "guide-box", return_all = TRUE)[[3]]
l2 <- cowplot::get_plot_component(pc, "guide-box", return_all = TRUE)[[3]]
cowplot::plot_grid(
cowplot::plot_grid(
pa + theme(legend.position = "none"), pb_fin, pc_fin,
labels = LETTERS[1:3], nrow = 1, rel_widths = c(0.34, 0.33, 0.33)
),
cowplot::plot_grid(
"", l, l2, "",
NULL, l, l2, NULL,
nrow = 1, rel_widths = c(0.175, 0.325, 0.325, 0.175)
),
ncol = 1, rel_heights = c(0.95, 0.05)
Expand Down Expand Up @@ -887,7 +887,10 @@ model_output_plot <- dplyr::bind_rows(mean_ens, model_output_plot) |>
output_type %in% c("median", "mean", "quantile"),
reference_date == "2022-12-17"
) |>
dplyr::mutate(target_date = reference_date + horizon)
dplyr::mutate(
target_date = reference_date + horizon,
output_type_id = as.numeric(output_type_id)
)
target_data_plot <- hubExamples::forecast_target_ts |>
dplyr::filter(
location == "25",
Expand All @@ -911,7 +914,7 @@ p2 <-
labs(y = "incident hospitalizations")
# Pull legend
l <- cowplot::get_legend(p1)
l <- cowplot::get_plot_component(p1, "guide-box", return_all = TRUE)[[3]]
# Assemble plots
cowplot::plot_grid(
Expand Down Expand Up @@ -970,7 +973,7 @@ flu_forecasts_raw |>
target == "1 wk ahead inc flu hosp",
quantile %in% c(0.025, 0.1, 0.25, 0.75, 0.9, 0.975)
) |>
dplyr::select(zoltar_col) |>
dplyr::select(all_of(zoltar_col)) |>
knitr::kable(col.names = formatted_zoltar_col)
```
Expand Down
404 changes: 238 additions & 166 deletions analysis/paper/hubEnsembles_manuscript.tex

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 5f4f963

Please sign in to comment.