@@ -20,10 +20,16 @@ ggplot2::autoplot
20
20
# ' @param .levels A numeric vector of levels to plot for any prediction bands.
21
21
# ' More than 3 levels begins to be difficult to see.
22
22
# ' @param ... Ignored
23
+ # ' @param .color_by A character string indicating how to color the data. See
24
+ # ' `epiprocess::autoplot.epi_df()` for more details.
25
+ # ' @param .facet_by A character string indicating how to facet the data. See
26
+ # ' `epiprocess::autoplot.epi_df()` for more details.
23
27
# ' @param .base_color If available, prediction bands will be shown with this
24
28
# ' color.
25
29
# ' @param .point_pred_color If available, point forecasts will be shown with this
26
30
# ' color.
31
+ # ' @param .max_facets The maximum number of facets to show. If the number of
32
+ # ' facets is greater than this value, only the top facets will be shown.
27
33
# '
28
34
# ' @name autoplot-epipred
29
35
# ' @examples
@@ -91,6 +97,9 @@ autoplot.epi_workflow <- function(
91
97
.max_facets = Inf ) {
92
98
rlang :: check_dots_empty()
93
99
arg_is_probabilities(.levels )
100
+ rlang :: arg_match(.color_by )
101
+ rlang :: arg_match(.facet_by )
102
+
94
103
if (! workflows :: is_trained_workflow(object )) {
95
104
cli :: cli_abort(c(
96
105
" Can't plot an untrained {.cls epi_workflow}." ,
@@ -197,8 +206,6 @@ autoplot.epi_workflow <- function(
197
206
bp
198
207
}
199
208
200
-
201
-
202
209
# ' @export
203
210
# ' @rdname autoplot-epipred
204
211
autoplot.canned_epipred <- function (
@@ -209,6 +216,9 @@ autoplot.canned_epipred <- function(
209
216
.point_pred_color = " orange" ,
210
217
.max_facets = Inf ) {
211
218
rlang :: check_dots_empty()
219
+ rlang :: arg_match(.color_by )
220
+ rlang :: arg_match(.facet_by )
221
+
212
222
ewf <- object $ epi_workflow
213
223
predictions <- object $ predictions %> %
214
224
dplyr :: rename(time_value = target_date )
@@ -283,7 +293,6 @@ plot_bands <- function(
283
293
base_plot
284
294
}
285
295
286
-
287
296
find_level <- function (x ) {
288
297
unique((x < .5 ) * (1 - 2 * x ) + (x > .5 ) * (1 - 2 * (1 - x )))
289
298
}
0 commit comments