@@ -320,17 +320,27 @@ geo_choose <- "ca"
320320forecasts_filtered <- forecasts |>
321321 filter(geo_value == geo_choose) |>
322322 mutate(time_value = version)
323+ # we need to add the ground truth data to the version faithful plot as well
324+ plotting_data <- bind_rows(
325+ percent_cli_data,
326+ percent_cli_data %>%
327+ filter(version_faithful == "Version un-faithful") %>%
328+ mutate(version_faithful = "Version faithful")
329+ )
323330
324331p1 <- # first plotting the forecasts as bands, lines and points
325332 ggplot(data = forecasts_filtered, aes(x = target_date, group = time_value)) +
326333 geom_ribbon(aes(ymin = `0.05`, ymax = `0.95`, fill = factor(time_value)), alpha = 0.4) +
327334 geom_line(aes(y = .pred, color = factor(time_value)), linetype = 2L) +
328335 geom_point(aes(y = .pred, color = factor(time_value)), size = 0.75) +
329336 # the forecast date
330- geom_vline(data = percent_cli_data |> filter(geo_value == geo_choose) |> select(-version_faithful), aes(color = factor(version), xintercept = version), lty = 2) +
337+ geom_vline(
338+ data = percent_cli_data |> filter(geo_value == geo_choose) |> select(-version_faithful),
339+ aes(color = factor(version), xintercept = version),
340+ lty = 2) +
331341 # the underlying data
332342 geom_line(
333- data = percent_cli_data |> filter(geo_value == geo_choose),
343+ data = plotting_data |> filter(geo_value == geo_choose),
334344 aes(x = time_value, y = percent_cli, color = factor(version)),
335345 inherit.aes = FALSE, na.rm = TRUE
336346 ) +
@@ -357,7 +367,7 @@ p2 <-
357367 aes(color = factor(version), xintercept = version), lty = 2
358368 ) +
359369 geom_line(
360- data = percent_cli_data |> filter(geo_value == geo_choose),
370+ data = plotting_data |> filter(geo_value == geo_choose),
361371 aes(x = time_value, y = percent_cli, color = factor(version)),
362372 inherit.aes = FALSE, na.rm = TRUE
363373 ) +
0 commit comments