Skip to content

Commit 16f6c2c

Browse files
committed
example plotting with ggplot2 handled correctly
1 parent c13b83e commit 16f6c2c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

R/layer_cdc_flatline_quantiles.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
#' pivot_quantiles(.pred_distn) %>%
7676
#' mutate(target_date = forecast_date + ahead)
7777
#'
78-
#' library(ggplot2)
78+
#' if (require("ggplot2")) {
7979
#' four_states <- c("ca", "pa", "wa", "ny")
8080
#' preds %>%
8181
#' filter(geo_value %in% four_states) %>%
@@ -92,7 +92,7 @@
9292
#' facet_wrap(~geo_value, scales = "free_y") +
9393
#' theme_bw() +
9494
#' geom_vline(xintercept = forecast_date)
95-
#'
95+
#' }
9696
layer_cdc_flatline_quantiles <- function(
9797
frosting,
9898
...,

R/make_smooth_quantile_reg.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@
6161
#' lines(pl$x, pl$`0.2`, col = "blue")
6262
#' lines(pl$x, pl$`0.8`, col = "blue")
6363
#' lines(pl$x, pl$`0.5`, col = "red")
64-
#' \dontrun{
64+
#'
65+
#' if (require("ggplot2")) {
6566
#' ggplot(data.frame(x = x, y = y), aes(x)) +
6667
#' geom_ribbon(data = pl, aes(ymin = `0.2`, ymax = `0.8`), fill = "lightblue") +
6768
#' geom_point(aes(y = y), colour = "grey") + # observed data

0 commit comments

Comments
 (0)