diff --git a/NEWS.md b/NEWS.md index cf6771aa..08d54f94 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # bayesplot (development version) +* Deprecate user-facing `size` arguments that controlled line width in favor of `linewidth` across all plotting functions. +* Deprecate the `fatten` argument in `ppc_intervals()`, `ppd_intervals()`, `ppc_loo_intervals()`, `ppc_bars()`, and their grouped variants. Point size in `geom_pointrange()` is now controlled directly by `size`. * Added test verifying `legend_move("none")` behaves equivalently to `legend_none()`. * Added singleton-dimension edge-case tests for exported `_data()` functions. * Validate empty list and zero-row matrix inputs in `nuts_params.list()`. diff --git a/R/bayesplot-package.R b/R/bayesplot-package.R index db740a9a..eb26da38 100644 --- a/R/bayesplot-package.R +++ b/R/bayesplot-package.R @@ -4,8 +4,8 @@ #' @aliases bayesplot #' #' @import ggplot2 stats rlang -#' @importFrom dplyr %>% summarise group_by select #' @importFrom lifecycle deprecated deprecate_warn is_present +#' @importFrom dplyr %>% summarise group_by select #' #' @description #' \if{html}{ diff --git a/R/helpers-shared.R b/R/helpers-shared.R index 34890feb..e3e4f1fe 100644 --- a/R/helpers-shared.R +++ b/R/helpers-shared.R @@ -45,6 +45,59 @@ check_ignored_arguments <- function(..., ok_args = character()) { } } +#' Handle size -> linewidth deprecation +#' +#' @param size User's `size` argument (deprecated for lines). +#' @param linewidth User's `linewidth` argument (replacement). +#' @param default_linewidth Default linewidth value if neither is specified. +#' @param calling_fn Name of the calling function for the deprecation message. +#' @return The resolved linewidth value. +#' @noRd +resolve_linewidth <- function(size, linewidth, default_linewidth, calling_fn = NULL) { + fn_name <- calling_fn %||% "fn" + if (!is.null(size) && !is.null(linewidth)) { + abort(paste0( + "Both `size` and `linewidth` were supplied to `", fn_name, "()`. ", + "Please use only `linewidth`." + )) + } + if (!is.null(size)) { + lifecycle::deprecate_warn( + when = "1.16.0", + what = paste0(fn_name, "(size)"), + with = paste0(fn_name, "(linewidth)") + ) + return(size) + } + linewidth %||% default_linewidth +} + + +#' Handle fatten deprecation +#' +#' @param fatten User's `fatten` argument (deprecated). +#' @param size User's `size` argument. +#' @param default_size Default size when neither `fatten` nor `size` is given. +#' @param calling_fn Name of the calling function for the deprecation message. +#' @return The resolved point `size` value. +#' @noRd +resolve_fatten <- function(fatten, size, default_size, calling_fn = NULL) { + if (!lifecycle::is_present(fatten)) { + return(size %||% default_size) + } + + lifecycle::deprecate_warn( + when = "1.16.0", + what = paste0(calling_fn %||% "fn", "(fatten)"), + details = paste0( + "The point size is now controlled directly by `size`. ", + "The `fatten` argument will be removed in a future release." + ) + ) + size %||% default_size +} + + #' Validate bounds passed to stat_density/geom_density wrappers #' @noRd validate_density_bounds <- function(bounds) { diff --git a/R/mcmc-diagnostics.R b/R/mcmc-diagnostics.R index 87e716da..392ab15c 100644 --- a/R/mcmc-diagnostics.R +++ b/R/mcmc-diagnostics.R @@ -10,8 +10,9 @@ #' #' @template args-hist #' @param size Optional values to override [ggplot2::geom_point()]'s -#' default size (for `mcmc_rhat()`, `mcmc_neff()`) or -#' [ggplot2::geom_line()]'s default line width (for `mcmc_acf()`). +#' default size (for `mcmc_rhat()`, `mcmc_neff()`). +#' @param linewidth Optional value to override [ggplot2::geom_line()]'s +#' default line width (for `mcmc_acf()`). #' @param ... Currently ignored. #' #' @template return-ggplot-or-data @@ -322,15 +323,17 @@ mcmc_acf <- ..., facet_args = list(), lags = 20, - size = NULL) { + size = NULL, + linewidth = NULL) { check_ignored_arguments(...) + linewidth <- resolve_linewidth(size, linewidth, default_linewidth = NULL, calling_fn = "mcmc_acf") .mcmc_acf( x, pars = pars, regex_pars = regex_pars, facet_args = facet_args, lags = lags, - size = size, + linewidth = linewidth, style = "line" ) } @@ -514,7 +517,7 @@ drop_NAs_and_warn <- function(x) { } # Autocorrelation plot (either bar or line) -# @param size passed to geom_line() if style="line" +# @param linewidth passed to geom_line() if style="line" .mcmc_acf <- function(x, pars = character(), @@ -522,7 +525,7 @@ drop_NAs_and_warn <- function(x) { facet_args = list(), lags = 25, style = c("bar", "line"), - size = NULL) { + linewidth = NULL) { style <- match.arg(style) x <- prepare_mcmc_array(x, pars, regex_pars) @@ -559,7 +562,7 @@ drop_NAs_and_warn <- function(x) { ) + do.call( "geom_line", - args = c(list(color = get_color("d")), linewidth = size) + args = c(list(color = get_color("d")), linewidth = linewidth) ) } diff --git a/R/mcmc-parcoord.R b/R/mcmc-parcoord.R index a0cc54ca..8c1bb7cd 100644 --- a/R/mcmc-parcoord.R +++ b/R/mcmc-parcoord.R @@ -13,7 +13,7 @@ #' @template args-regex_pars #' @template args-transformations #' @param ... Currently ignored. -#' @param size,alpha Arguments passed on to [ggplot2::geom_line()]. +#' @param size,alpha,linewidth Arguments passed on to [ggplot2::geom_line()]. #' @param np For models fit using [NUTS] (more generally, #' any [symplectic integrator](https://en.wikipedia.org/wiki/Symplectic_integrator)), #' an optional data frame providing NUTS diagnostic information. The data @@ -114,11 +114,13 @@ mcmc_parcoord <- regex_pars = character(), transformations = list(), ..., - size = 0.2, + size = NULL, + linewidth = 0.2, alpha = 0.3, np = NULL, np_style = parcoord_style_np()) { check_ignored_arguments(...) + linewidth <- resolve_linewidth(size, linewidth, default_linewidth = 0.2, calling_fn = "mcmc_parcoord") stopifnot(inherits(np_style, "nuts_style")) data <- @@ -142,7 +144,7 @@ mcmc_parcoord <- group = factor(.data$Draw) )) + geom_line( - linewidth = size, + linewidth = linewidth, alpha = alpha, color = get_color("dh") ) + diff --git a/R/ppc-censoring.R b/R/ppc-censoring.R index bcca33d6..d07b30f4 100644 --- a/R/ppc-censoring.R +++ b/R/ppc-censoring.R @@ -15,8 +15,8 @@ #' @family PPCs #' #' @template args-y-yrep -#' @param size,alpha Passed to the appropriate geom to control the appearance of -#' the `yrep` distributions. +#' @param size,alpha,linewidth Passed to the appropriate geom to control the +#' appearance of the `yrep` distributions. #' @param ... Currently only used internally. #' #' @template return-ggplot @@ -103,10 +103,12 @@ ppc_km_overlay <- function( status_y, left_truncation_y = NULL, extrapolation_factor = 1.2, - size = 0.25, + size = NULL, + linewidth = 0.25, alpha = 0.7 ) { check_ignored_arguments(..., ok_args = "add_group") + linewidth <- resolve_linewidth(size, linewidth, default_linewidth = 0.25, calling_fn = "ppc_km_overlay") add_group <- list(...)$add_group suggested_package("survival") @@ -172,7 +174,7 @@ ppc_km_overlay <- function( } fsf$is_y_color <- as.factor(sub("\\[rep\\] \\(.*$", "rep", sub("^italic\\(y\\)", "y", fsf$strata))) - fsf$is_y_linewidth <- ifelse(fsf$is_y_color == "yrep", size, 1) + fsf$is_y_linewidth <- ifelse(fsf$is_y_color == "yrep", linewidth, 1) fsf$is_y_alpha <- ifelse(fsf$is_y_color == "yrep", alpha, 1) max_time_y <- max(y, na.rm = TRUE) @@ -225,7 +227,8 @@ ppc_km_overlay_grouped <- function( status_y, left_truncation_y = NULL, extrapolation_factor = 1.2, - size = 0.25, + size = NULL, + linewidth = 0.25, alpha = 0.7 ) { check_ignored_arguments(...) @@ -238,6 +241,7 @@ ppc_km_overlay_grouped <- function( status_y = status_y, left_truncation_y = left_truncation_y, size = size, + linewidth = linewidth, alpha = alpha, extrapolation_factor = extrapolation_factor ) diff --git a/R/ppc-discrete.R b/R/ppc-discrete.R index 2fc117a3..2ccdf058 100644 --- a/R/ppc-discrete.R +++ b/R/ppc-discrete.R @@ -18,10 +18,12 @@ #' of the expected counts.) #' @param width For bar plots only, passed to [ggplot2::geom_bar()] to control #' the bar width. -#' @param size,fatten,linewidth For bar plots, `size`, `fatten`, and `linewidth` -#' are passed to [ggplot2::geom_pointrange()] to control the appearance of the -#' `yrep` points and intervals. For rootograms `size` is passed to +#' @param size,linewidth For bar plots, `size` and `linewidth` are passed to +#' [ggplot2::geom_pointrange()] to control the appearance of the `yrep` points +#' and intervals, where `size` controls the point size and `linewidth` controls +#' the line width. For rootograms `size` is passed to #' [ggplot2::geom_line()] and [ggplot2::geom_pointrange()]. +#' @param fatten Deprecated. Point size is now controlled directly by `size`. #' @param freq For bar plots only, if `TRUE` (the default) the y-axis will #' display counts. Setting `freq=FALSE` will put proportions on the y-axis. #' @param bound_distinct For `ppc_rootogram(style = "discrete)` and `ppc_rootogram_grouped(style = "discrete)`, @@ -151,7 +153,6 @@ #' group = esoph$agegp, #' freq=FALSE, #' prob = 0.5, -#' fatten = 1, #' size = 1.5 #' ) #' } @@ -185,7 +186,7 @@ ppc_bars <- prob = 0.9, width = 0.9, size = 1, - fatten = 2.5, + fatten = deprecated(), linewidth = 1, freq = TRUE) { @@ -194,6 +195,8 @@ ppc_bars <- check_ignored_arguments(...) dots$group <- NULL } + size <- resolve_fatten(fatten, size, default_size = 1, + calling_fn = "ppc_bars") data <- ppc_bars_data( y = y, @@ -219,7 +222,6 @@ ppc_bars <- geom_pointrange( mapping = intervals_inner_aes(needs_y = TRUE, color = "yrep"), size = size, - fatten = fatten, linewidth = linewidth, na.rm = TRUE ) + @@ -252,7 +254,7 @@ ppc_bars_grouped <- prob = 0.9, width = 0.9, size = 1, - fatten = 2.5, + fatten = deprecated(), linewidth = 1, freq = TRUE) { check_ignored_arguments(...) @@ -305,7 +307,6 @@ ppc_rootogram <- function(y, bound_distinct = bound_distinct ) - # Building geoms for y and y_rep geom_y <- if (style == "discrete") { geom_point( aes(y = .data$obs, shape = .data$obs_shape), diff --git a/R/ppc-distributions.R b/R/ppc-distributions.R index 7ab9ffb8..a5c5ad52 100644 --- a/R/ppc-distributions.R +++ b/R/ppc-distributions.R @@ -13,8 +13,10 @@ #' @template args-hist-freq #' @template args-dens #' @template args-pit-ecdf -#' @param size,alpha Passed to the appropriate geom to control the appearance of -#' the predictive distributions. +#' @param linewidth,alpha Passed to the appropriate geom to control the +#' appearance of the predictive distributions. For overlay and density-type +#' plots, `linewidth` controls the line width. +#' @param size Deprecated for line-width control. Use `linewidth` instead. #' @param ... For dot plots, optional additional arguments to pass to [ggdist::stat_dots()]. #' #' @template details-binomial @@ -110,7 +112,7 @@ #' #' \donttest{ #' # frequency polygons -#' ppc_freqpoly(y, yrep[1:3, ], alpha = 0.1, size = 1, binwidth = 5) +#' ppc_freqpoly(y, yrep[1:3, ], alpha = 0.1, linewidth = 1, binwidth = 5) #' #' ppc_freqpoly_grouped(y, yrep[1:3, ], group) + yaxis_text() #' @@ -133,7 +135,7 @@ #' # don't need to only use small number of rows for ppc_violin_grouped #' # (as it pools yrep draws within groups) #' color_scheme_set("gray") -#' ppc_violin_grouped(y, yrep, group, size = 1.5) +#' ppc_violin_grouped(y, yrep, group, linewidth = 1.5) #' ppc_violin_grouped(y, yrep, group, alpha = 0) #' #' # change how y is drawn @@ -167,7 +169,8 @@ ppc_dens_overlay <- function(y, yrep, ..., - size = 0.25, + size = NULL, + linewidth = 0.25, alpha = 0.7, trim = FALSE, bw = "nrd0", @@ -176,6 +179,7 @@ ppc_dens_overlay <- bounds = NULL, n_dens = 1024) { check_ignored_arguments(...) + linewidth <- resolve_linewidth(size, linewidth, default_linewidth = 0.25, calling_fn = "ppc_dens_overlay") bounds <- validate_density_bounds(bounds) data <- ppc_data(y, yrep) @@ -183,7 +187,7 @@ ppc_dens_overlay <- overlay_ppd_densities( mapping = aes(group = .data$rep_id, color = "yrep"), data = function(x) dplyr::filter(x, !.data$is_y), - linewidth = size, + linewidth = linewidth, alpha = alpha, trim = trim, bw = bw, @@ -221,7 +225,8 @@ ppc_dens_overlay_grouped <- function(y, yrep, group, ..., - size = 0.25, + size = NULL, + linewidth = 0.25, alpha = 0.7, trim = FALSE, bw = "nrd0", @@ -230,12 +235,13 @@ ppc_dens_overlay_grouped <- function(y, bounds = NULL, n_dens = 1024) { check_ignored_arguments(...) + linewidth <- resolve_linewidth(size, linewidth, default_linewidth = 0.25, calling_fn = "ppc_dens_overlay_grouped") p_overlay <- ppc_dens_overlay( y = y, yrep = yrep, ..., - size = size, + linewidth = linewidth, alpha = alpha, trim = trim, bw = bw, @@ -267,7 +273,8 @@ ppc_ecdf_overlay <- function(y, ..., discrete = deprecated(), pad = TRUE, - size = 0.25, + size = NULL, + linewidth = 0.25, alpha = 0.7) { check_ignored_arguments(...) @@ -278,9 +285,9 @@ ppc_ecdf_overlay <- function(y, details = "The ECDF is now always plotted as a step function." ) } + linewidth <- resolve_linewidth(size, linewidth, default_linewidth = 0.25, calling_fn = "ppc_ecdf_overlay") data <- ppc_data(y, yrep) - ggplot(data) + aes(x = .data$value) + hline_at( @@ -299,7 +306,7 @@ ppc_ecdf_overlay <- function(y, data = function(x) dplyr::filter(x, !.data$is_y), mapping = aes(group = .data$rep_id, color = "yrep"), geom = "step", - linewidth = size, + linewidth = linewidth, alpha = alpha, pad = pad ) + @@ -325,9 +332,11 @@ ppc_ecdf_overlay_grouped <- function(y, ..., discrete = deprecated(), pad = TRUE, - size = 0.25, + size = NULL, + linewidth = 0.25, alpha = 0.7) { check_ignored_arguments(...) + linewidth <- resolve_linewidth(size, linewidth, default_linewidth = 0.25, calling_fn = "ppc_ecdf_overlay_grouped") if (is_present(discrete)) { deprecate_warn( @@ -342,7 +351,7 @@ ppc_ecdf_overlay_grouped <- function(y, yrep = yrep, ..., pad = pad, - size = size, + linewidth = linewidth, alpha = alpha ) @@ -363,10 +372,12 @@ ppc_dens <- yrep, ..., trim = FALSE, - size = 0.5, + size = NULL, + linewidth = 0.5, alpha = 1, bounds = NULL) { check_ignored_arguments(...) + linewidth <- resolve_linewidth(size, linewidth, default_linewidth = 0.5, calling_fn = "ppc_dens") bounds <- validate_density_bounds(bounds) data <- ppc_data(y, yrep) ggplot(data, mapping = aes( @@ -375,7 +386,7 @@ ppc_dens <- color = .data$is_y_label )) + geom_density( - linewidth = size, + linewidth = linewidth, alpha = alpha, trim = trim, bounds = bounds @@ -445,13 +456,15 @@ ppc_freqpoly <- binwidth = NULL, bins = NULL, freq = TRUE, - size = 0.5, + size = NULL, + linewidth = 0.5, alpha = 1) { dots <- list(...) if (!from_grouped(dots)) { check_ignored_arguments(...) dots$group <- NULL } + linewidth <- resolve_linewidth(size, linewidth, default_linewidth = 0.5, calling_fn = "ppc_freqpoly") data <- ppc_data(y, yrep, group = dots$group) ggplot(data, mapping = set_hist_aes( @@ -463,7 +476,7 @@ ppc_freqpoly <- stat = "bin", binwidth = binwidth, bins = bins, - linewidth = size, + linewidth = linewidth, alpha = alpha ) + scale_fill_ppc() + @@ -491,7 +504,8 @@ ppc_freqpoly_grouped <- binwidth = NULL, bins = NULL, freq = TRUE, - size = 0.5, + size = NULL, + linewidth = 0.5, alpha = 1) { check_ignored_arguments(...) call <- match.call(expand.dots = FALSE) @@ -519,9 +533,11 @@ ppc_boxplot <- yrep, ..., notch = TRUE, - size = 0.5, + size = NULL, + linewidth = 0.5, alpha = 1) { check_ignored_arguments(...) + linewidth <- resolve_linewidth(size, linewidth, default_linewidth = 0.5, calling_fn = "ppc_boxplot") data <- ppc_data(y, yrep) ggplot(data, mapping = aes( @@ -532,7 +548,7 @@ ppc_boxplot <- )) + geom_boxplot( notch = notch, - linewidth = size, + linewidth = linewidth, alpha = alpha, outlier.alpha = 2 / 3, outlier.size = 1 @@ -605,13 +621,15 @@ ppc_violin_grouped <- group, ..., probs = c(0.1, 0.5, 0.9), - size = 1, + size = NULL, + linewidth = 1, alpha = 1, y_draw = c("violin", "points", "both"), y_size = 1, y_alpha = 1, y_jitter = 0.1) { check_ignored_arguments(...) + linewidth <- resolve_linewidth(size, linewidth, default_linewidth = 1, calling_fn = "ppc_violin_grouped") y_draw <- match.arg(y_draw) y_violin <- y_draw %in% c("violin", "both") @@ -622,7 +640,7 @@ ppc_violin_grouped <- aes(fill = "yrep", color = "yrep"), draw_quantiles = probs, alpha = alpha, - linewidth = size + linewidth = linewidth ) if (utils::packageVersion("ggplot2") >= "4.0.0") { args_violin_yrep$draw_quantiles <- NULL diff --git a/R/ppc-errors.R b/R/ppc-errors.R index f0012f24..c1415763 100644 --- a/R/ppc-errors.R +++ b/R/ppc-errors.R @@ -19,6 +19,7 @@ #' [ggplot2::geom_point()] to control the appearance of the points. For the #' binned error plot, arguments controlling the size of the outline and #' opacity of the shaded region indicating the 2-SE bounds. +#' @param linewidth For the binned error plot, the line width of the outline. #' #' @details #' All of these functions (aside from the `*_scatter_avg` functions) @@ -341,9 +342,11 @@ ppc_error_binned <- ..., facet_args = list(), bins = NULL, - size = 1, + size = NULL, + linewidth = 1, alpha = 0.25) { check_ignored_arguments(...) + linewidth <- resolve_linewidth(size, linewidth, default_linewidth = 1, calling_fn = "ppc_error_binned") qx <- enquo(x) data <- ppc_error_binnned_data(y, yrep, x = x, bins = bins) @@ -369,12 +372,12 @@ ppc_error_binned <- geom_path( mapping = aes(y = .data$se2), color = get_color("l"), - linewidth = size + linewidth = linewidth ) + geom_path( mapping = aes(y = -.data$se2), color = get_color("l"), - linewidth = size + linewidth = linewidth ) + geom_point( mapping = aes(y = .data$err_bar), diff --git a/R/ppc-intervals.R b/R/ppc-intervals.R index b41be3b0..2702d1d7 100644 --- a/R/ppc-intervals.R +++ b/R/ppc-intervals.R @@ -16,13 +16,14 @@ #' variable. For example, `x` could be a predictor variable from a #' regression model, a time variable for time-series models, etc. If `x` #' is missing or `NULL` then the observation index is used for the x-axis. -#' @param alpha,size,fatten,linewidth Arguments passed to geoms. For ribbon -#' plots `alpha` is passed to [ggplot2::geom_ribbon()] to control the opacity -#' of the outer ribbon and `size` is passed to [ggplot2::geom_line()] to -#' control the size of the line representing the median prediction (`size=0` -#' will remove the line). For interval plots `alpha`, `size`, `fatten`, and -#' `linewidth` are passed to [ggplot2::geom_pointrange()] (`fatten=0` will -#' remove the point estimates). +#' @param alpha,size,linewidth Arguments passed to geoms. For ribbon plots +#' `alpha` is passed to [ggplot2::geom_ribbon()] to control the opacity of the +#' outer ribbon and `linewidth` is passed to [ggplot2::geom_line()] to control +#' the width of the line representing the median prediction (`linewidth=0` +#' will remove the line). For interval plots `alpha`, `size`, and `linewidth` +#' are passed to [ggplot2::geom_pointrange()] where `size` controls the point +#' size and `linewidth` controls the line width. +#' @param fatten Deprecated. Point size is now controlled directly by `size`. #' @param ... Currently unused. #' #' @template return-ggplot-or-data @@ -71,11 +72,11 @@ #' ppc_ribbon(y, yrep, y_draw = "both") #' } #' -#' ppc_intervals(y, yrep, size = 1.5, fatten = 0) # remove the yrep point estimates +#' ppc_intervals(y, yrep, size = 0) # remove the yrep point estimates #' #' color_scheme_set("teal") #' year <- 1950:1999 -#' ppc_intervals(y, yrep, x = year, fatten = 1) + ggplot2::xlab("Year") +#' ppc_intervals(y, yrep, x = year, size = 1) + ggplot2::xlab("Year") #' ppc_ribbon(y, yrep, x = year) + ggplot2::xlab("Year") #' #' color_scheme_set("pink") @@ -136,7 +137,7 @@ ppc_intervals <- prob_outer = 0.9, alpha = 0.33, size = 1, - fatten = 2.5, + fatten = deprecated(), linewidth = 1) { dots <- list(...) @@ -144,6 +145,8 @@ ppc_intervals <- check_ignored_arguments(...) dots$group <- NULL } + size <- resolve_fatten(fatten, size, default_size = 1, + calling_fn = "ppc_intervals") data <- ppc_intervals_data( @@ -170,7 +173,6 @@ ppc_intervals <- shape = 21, stroke = 0.5, size = size, - fatten = fatten, linewidth = linewidth ) + geom_point( @@ -203,7 +205,7 @@ ppc_intervals_grouped <- prob_outer = 0.9, alpha = 0.33, size = 1, - fatten = 2.5, + fatten = deprecated(), linewidth = 1) { check_ignored_arguments(...) call <- match.call(expand.dots = FALSE) @@ -226,10 +228,14 @@ ppc_ribbon <- prob = 0.5, prob_outer = 0.9, alpha = 0.33, - size = 0.25, + size = NULL, + linewidth = 0.25, y_draw = c("line", "points", "both")) { y_draw <- match.arg(y_draw) + linewidth <- resolve_linewidth(size, linewidth, + default_linewidth = 0.25, + calling_fn = "ppc_ribbon") dots <- list(...) if (!from_grouped(dots)) { check_ignored_arguments(...) @@ -251,21 +257,21 @@ ppc_ribbon <- geom_ribbon( mapping = intervals_outer_aes(fill = "yrep", color = "yrep"), color = NA, - linewidth = 0.2 * size, + linewidth = 0.2 * linewidth, alpha = alpha ) + geom_ribbon( mapping = intervals_outer_aes(), fill = NA, color = get_color("m"), - linewidth = 0.2 * size, + linewidth = 0.2 * linewidth, alpha = 1 ) + - geom_ribbon(linewidth = 0.5 * size) + + geom_ribbon(linewidth = 0.5 * linewidth) + geom_line( mapping = aes(y = .data$m), color = get_color("m"), - linewidth = size + linewidth = linewidth ) + geom_blank(aes(fill = "y")) @@ -303,7 +309,8 @@ ppc_ribbon_grouped <- prob = 0.5, prob_outer = 0.9, alpha = 0.33, - size = 0.25, + size = NULL, + linewidth = 0.25, y_draw = c("line", "points", "both")) { check_ignored_arguments(...) call <- match.call(expand.dots = FALSE) diff --git a/R/ppc-loo.R b/R/ppc-loo.R index 1be70f14..152686a2 100644 --- a/R/ppc-loo.R +++ b/R/ppc-loo.R @@ -15,13 +15,14 @@ #' @param psis_object If using **loo** version `2.0.0` or greater, an #' object returned by the `psis()` function (or by the `loo()` function #' with argument `save_psis` set to `TRUE`). -#' @param alpha,size,fatten,linewidth Arguments passed to code geoms to control -#' plot aesthetics. For `ppc_loo_pit_qq()` and `ppc_loo_pit_overlay()`,`size` -#' and `alpha` are passed to [ggplot2::geom_point()] and -#' [ggplot2::geom_density()], respectively. For `ppc_loo_intervals()`, `size` -#' `linewidth` and `fatten` are passed to [ggplot2::geom_pointrange()]. For -#' `ppc_loo_ribbon()`, `alpha` and `size` are passed to -#' [ggplot2::geom_ribbon()]. +#' @param alpha,size,linewidth Arguments passed to geoms to control plot +#' aesthetics. For `ppc_loo_pit_qq()`, `size` and `alpha` are passed to +#' [ggplot2::geom_point()]. For `ppc_loo_pit_overlay()`, `linewidth` and +#' `alpha` control the line width and opacity. For `ppc_loo_intervals()`, +#' `size` controls the point size and `linewidth` controls the line width +#' in [ggplot2::geom_pointrange()]. For `ppc_loo_ribbon()`, `alpha` and +#' `linewidth` control the ribbon opacity and median line width. +#' @param fatten Deprecated. Point size is now controlled directly by `size`. #' #' @template return-ggplot-or-data #' @@ -177,7 +178,8 @@ ppc_loo_pit_overlay <- function(y, psis_object = NULL, pit = NULL, samples = 100, - size = 0.25, + size = NULL, + linewidth = 0.25, alpha = 0.7, boundary_correction = TRUE, grid_len = 512, @@ -187,6 +189,9 @@ ppc_loo_pit_overlay <- function(y, kernel = "gaussian", n_dens = 1024) { check_ignored_arguments(..., ok_args = list("moment_match")) + linewidth <- resolve_linewidth(size, linewidth, + default_linewidth = 0.25, + calling_fn = "ppc_loo_pit_overlay") data <- ppc_loo_pit_data( @@ -221,7 +226,7 @@ ppc_loo_pit_overlay <- function(y, aes(group = .data$rep_id, color = "yrep"), data = function(x) dplyr::filter(x, !.data$is_y), alpha = alpha, - linewidth = size, + linewidth = linewidth, na.rm = TRUE ) + geom_line( @@ -245,7 +250,7 @@ ppc_loo_pit_overlay <- function(y, data = function(x) dplyr::filter(x, !.data$is_y), geom = "line", position = "identity", - linewidth = size, + linewidth = linewidth, alpha = alpha, trim = trim, bw = bw, @@ -545,10 +550,12 @@ ppc_loo_intervals <- prob_outer = 0.9, alpha = 0.33, size = 1, - fatten = 2.5, + fatten = deprecated(), linewidth = 1, order = c("index", "median")) { check_ignored_arguments(..., ok_args = list("moment_match")) + size <- resolve_fatten(fatten, size, default_size = 1, + calling_fn = "ppc_loo_intervals") y <- validate_y(y) order_by_median <- match.arg(order) == "median" if (!is.null(intervals)) { @@ -600,14 +607,13 @@ ppc_loo_intervals <- geom_linerange( mapping = intervals_outer_aes(color = "yrep"), alpha = alpha, - linewidth = size + linewidth = linewidth ) + geom_pointrange( shape = 21, stroke = 0.5, linewidth = linewidth, - size = size, - fatten = fatten + size = size ) + geom_point( mapping = aes( @@ -639,8 +645,12 @@ ppc_loo_ribbon <- prob = 0.5, prob_outer = 0.9, alpha = 0.33, - size = 0.25) { + size = NULL, + linewidth = 0.25) { check_ignored_arguments(..., ok_args = list("moment_match")) + linewidth <- resolve_linewidth(size, linewidth, + default_linewidth = 0.25, + calling_fn = "ppc_loo_ribbon") y <- validate_y(y) if (!is.null(intervals)) { stopifnot(is.matrix(intervals), ncol(intervals) %in% c(3, 5)) @@ -690,7 +700,7 @@ ppc_loo_ribbon <- geom_line( mapping = aes(y = .data$m), color = get_color("m"), - linewidth = size + linewidth = linewidth ) + geom_blank(aes(fill = "y")) + geom_line( diff --git a/R/ppd-distributions.R b/R/ppd-distributions.R index 03b7e20f..2930d135 100644 --- a/R/ppd-distributions.R +++ b/R/ppd-distributions.R @@ -42,7 +42,8 @@ ppd_dens_overlay <- function(ypred, show_marginal = FALSE, ..., - size = 0.25, + size = NULL, + linewidth = 0.25, alpha = 0.7, trim = FALSE, bw = "nrd0", @@ -51,13 +52,15 @@ ppd_dens_overlay <- bounds = NULL, n_dens = 1024) { check_ignored_arguments(...) + linewidth <- resolve_linewidth(size, linewidth, default_linewidth = 0.25, + calling_fn = "ppd_dens_overlay") bounds <- validate_density_bounds(bounds) data <- ppd_data(ypred) p <- ggplot(data, mapping = aes(x = .data$value)) + overlay_ppd_densities( mapping = aes(group = .data$rep_id, color = "ypred", linetype = "ypred"), - linewidth = size, + linewidth = linewidth, alpha = alpha, trim = trim, bw = bw, @@ -78,7 +81,7 @@ ppd_dens_overlay <- show_marginal = show_marginal, # in case user turns legend back on guide = guide_legend( - override.aes = list(linewidth = 2 * size, alpha = 1) + override.aes = list(linewidth = 2 * linewidth, alpha = 1) ) ) @@ -109,9 +112,12 @@ ppd_ecdf_overlay <- ..., discrete = deprecated(), pad = TRUE, - size = 0.25, + size = NULL, + linewidth = 0.25, alpha = 0.7) { check_ignored_arguments(...) + linewidth <- resolve_linewidth(size, linewidth, default_linewidth = 0.25, + calling_fn = "ppd_ecdf_overlay") if (is_present(discrete)) { deprecate_warn( @@ -132,7 +138,7 @@ ppd_ecdf_overlay <- stat_ecdf( mapping = aes(group = .data$rep_id, color = "ypred", linetype = "ypred"), geom = "step", - linewidth = size, + linewidth = linewidth, alpha = alpha, pad = pad ) + @@ -146,7 +152,7 @@ ppd_ecdf_overlay <- show_marginal = show_marginal, # in case user turns legend back on guide = guide_legend( - override.aes = list(linewidth = 2 * size, alpha = 1) + override.aes = list(linewidth = 2 * linewidth, alpha = 1) ) ) @@ -171,10 +177,13 @@ ppd_dens <- show_marginal = FALSE, ..., trim = FALSE, - size = 0.5, + size = NULL, + linewidth = 0.5, alpha = 1, bounds = NULL) { check_ignored_arguments(...) + linewidth <- resolve_linewidth(size, linewidth, default_linewidth = 0.5, + calling_fn = "ppd_dens") bounds <- validate_density_bounds(bounds) data <- ppd_data(ypred) @@ -182,7 +191,7 @@ ppd_dens <- geom_density( aes(color = "ypred", fill = "ypred"), - linewidth = size, + linewidth = linewidth, alpha = alpha, trim = trim, bounds = bounds @@ -339,7 +348,8 @@ ppd_freqpoly <- binwidth = NULL, bins = NULL, freq = !show_marginal, - size = 0.5, + size = NULL, + linewidth = 0.5, alpha = 1) { dots <- list(...) @@ -347,6 +357,8 @@ ppd_freqpoly <- check_ignored_arguments(...) dots$group <- NULL } + linewidth <- resolve_linewidth(size, linewidth, default_linewidth = 0.5, + calling_fn = "ppd_freqpoly") data <- ppd_data(ypred, group = dots$group) p <- ggplot(data, mapping = set_hist_aes(freq)) + @@ -356,7 +368,7 @@ ppd_freqpoly <- stat = "bin", binwidth = binwidth, bins = bins, - linewidth = size, + linewidth = linewidth, alpha = alpha ) + facet_wrap_parsed("rep_label") + @@ -403,10 +415,13 @@ ppd_freqpoly_grouped <- binwidth = NULL, bins = NULL, freq = !show_marginal, - size = 0.5, + size = NULL, + linewidth = 0.5, alpha = 1) { check_ignored_arguments(...) + linewidth <- resolve_linewidth(size, linewidth, default_linewidth = 0.5, + calling_fn = "ppd_freqpoly_grouped") call <- match.call(expand.dots = FALSE) g <- eval(ungroup_call("ppd_freqpoly", call), parent.frame()) g + @@ -428,9 +443,12 @@ ppd_boxplot <- show_marginal = FALSE, ..., notch = TRUE, - size = 0.5, + size = NULL, + linewidth = 0.5, alpha = 1) { check_ignored_arguments(...) + linewidth <- resolve_linewidth(size, linewidth, default_linewidth = 0.5, + calling_fn = "ppd_boxplot") data <- ppd_data(ypred) p <- ggplot(data, mapping = aes( @@ -441,7 +459,7 @@ ppd_boxplot <- aes(color = "ypred", fill = "ypred"), notch = notch, - linewidth = size, + linewidth = linewidth, alpha = alpha, outlier.color = get_color("lh"), outlier.alpha = 2/3, @@ -518,4 +536,3 @@ overlay_ppd_densities <- position = "identity") { stat_density(..., geom = geom, position = position) } - diff --git a/R/ppd-intervals.R b/R/ppd-intervals.R index 63184072..7a4691ae 100644 --- a/R/ppd-intervals.R +++ b/R/ppd-intervals.R @@ -23,12 +23,12 @@ #' group <- example_group_data() #' #' ppd_intervals(ypred[, 1:50]) -#' ppd_intervals(ypred[, 1:50], fatten = 0) -#' ppd_intervals(ypred[, 1:50], fatten = 0, linewidth = 2) -#' ppd_intervals(ypred[, 1:50], prob_outer = 0.75, fatten = 0, linewidth = 2) +#' ppd_intervals(ypred[, 1:50], size = 0) +#' ppd_intervals(ypred[, 1:50], size = 0, linewidth = 2) +#' ppd_intervals(ypred[, 1:50], prob_outer = 0.75, size = 0, linewidth = 2) #' #' # put a predictor variable on the x-axis -#' ppd_intervals(ypred[, 1:100], x = x[1:100], fatten = 1) + +#' ppd_intervals(ypred[, 1:100], x = x[1:100], size = 1) + #' ggplot2::labs(y = "Prediction", x = "Some variable of interest") #' #' # with a grouping variable too @@ -36,16 +36,15 @@ #' ypred = ypred[, 1:100], #' x = x[1:100], #' group = group[1:100], -#' size = 2, -#' fatten = 0, +#' size = 0, #' facet_args = list(nrow = 2) #' ) #' #' # even reducing size, ppd_intervals is too cluttered when there are many #' # observations included (ppd_ribbon is better) -#' ppd_intervals(ypred, size = 0.5, fatten = 0.1, linewidth = 0.5) +#' ppd_intervals(ypred, size = 0.1, linewidth = 0.5) #' ppd_ribbon(ypred) -#' ppd_ribbon(ypred, size = 0) # remove line showing median prediction +#' ppd_ribbon(ypred, linewidth = 0) # remove line showing median prediction #' NULL @@ -59,7 +58,7 @@ ppd_intervals <- prob_outer = 0.9, alpha = 0.33, size = 1, - fatten = 2.5, + fatten = deprecated(), linewidth = 1) { dots <- list(...) @@ -67,7 +66,8 @@ ppd_intervals <- check_ignored_arguments(...) dots$group <- NULL } - + size <- resolve_fatten(fatten, size, default_size = 1, + calling_fn = "ppd_intervals") data <- ppd_intervals_data( ypred = ypred, @@ -90,7 +90,6 @@ ppd_intervals <- shape = 21, stroke = 0.5, size = size, - fatten = fatten, linewidth = linewidth ) + scale_color_ppd() + @@ -113,7 +112,7 @@ ppd_intervals_grouped <- prob_outer = 0.9, alpha = 0.33, size = 1, - fatten = 2.5, + fatten = deprecated(), linewidth = 1) { check_ignored_arguments(...) call <- match.call(expand.dots = FALSE) @@ -133,8 +132,12 @@ ppd_ribbon <- prob = 0.5, prob_outer = 0.9, alpha = 0.33, - size = 0.25) { + size = NULL, + linewidth = 0.25) { + linewidth <- resolve_linewidth(size, linewidth, + default_linewidth = 0.25, + calling_fn = "ppd_ribbon") dots <- list(...) if (!from_grouped(dots)) { check_ignored_arguments(...) @@ -152,21 +155,21 @@ ppd_ribbon <- geom_ribbon( mapping = intervals_outer_aes(fill = "ypred", color = "ypred"), color = NA, - linewidth = 0.2 * size, + linewidth = 0.2 * linewidth, alpha = alpha ) + geom_ribbon( mapping = intervals_outer_aes(), fill = NA, color = get_color("mh"), - linewidth = 0.2 * size, + linewidth = 0.2 * linewidth, alpha = 1 ) + - geom_ribbon(linewidth = 0.5 * size) + + geom_ribbon(linewidth = 0.5 * linewidth) + geom_line( mapping = aes(y = .data$m), color = get_color("d"), - linewidth = size + linewidth = linewidth ) + scale_color_ppd() + scale_fill_ppd() + @@ -187,7 +190,8 @@ ppd_ribbon_grouped <- prob = 0.5, prob_outer = 0.9, alpha = 0.33, - size = 0.25) { + size = NULL, + linewidth = 0.25) { check_ignored_arguments(...) call <- match.call(expand.dots = FALSE) g <- eval(ungroup_call("ppd_ribbon", call), parent.frame()) diff --git a/man/MCMC-diagnostics.Rd b/man/MCMC-diagnostics.Rd index f6dbad81..bbd75508 100644 --- a/man/MCMC-diagnostics.Rd +++ b/man/MCMC-diagnostics.Rd @@ -31,7 +31,8 @@ mcmc_acf( ..., facet_args = list(), lags = 20, - size = NULL + size = NULL, + linewidth = NULL ) mcmc_acf_bar( @@ -49,8 +50,7 @@ mcmc_acf_bar( \item{...}{Currently ignored.} \item{size}{Optional values to override \code{\link[ggplot2:geom_point]{ggplot2::geom_point()}}'s -default size (for \code{mcmc_rhat()}, \code{mcmc_neff()}) or -\code{\link[ggplot2:geom_path]{ggplot2::geom_line()}}'s default line width (for \code{mcmc_acf()}).} +default size (for \code{mcmc_rhat()}, \code{mcmc_neff()}).} \item{binwidth}{Passed to \code{\link[ggplot2:geom_histogram]{ggplot2::geom_histogram()}}, \code{\link[ggplot2:geom_ribbon]{ggplot2::geom_area()}}, and \code{\link[ggdist:stat_dots]{ggdist::stat_dots()}} to override the default binwidth.} @@ -95,6 +95,9 @@ then \strong{bayesplot} may use \code{scales="free"} as the default (depending on the plot) instead of the \strong{ggplot2} default of \code{scales="fixed"}.} \item{lags}{The number of lags to show in the autocorrelation plot.} + +\item{linewidth}{Optional value to override \code{\link[ggplot2:geom_path]{ggplot2::geom_line()}}'s +default line width (for \code{mcmc_acf()}).} } \value{ The plotting functions return a ggplot object that can be further diff --git a/man/MCMC-parcoord.Rd b/man/MCMC-parcoord.Rd index cbb7d294..a2dd361b 100644 --- a/man/MCMC-parcoord.Rd +++ b/man/MCMC-parcoord.Rd @@ -13,7 +13,8 @@ mcmc_parcoord( regex_pars = character(), transformations = list(), ..., - size = 0.2, + size = NULL, + linewidth = 0.2, alpha = 0.3, np = NULL, np_style = parcoord_style_np() @@ -78,7 +79,7 @@ abbreviated for convenience in interactive use (e.g., \code{transform}).} \item{...}{Currently ignored.} -\item{size, alpha}{Arguments passed on to \code{\link[ggplot2:geom_path]{ggplot2::geom_line()}}.} +\item{size, alpha, linewidth}{Arguments passed on to \code{\link[ggplot2:geom_path]{ggplot2::geom_line()}}.} \item{np}{For models fit using \link{NUTS} (more generally, any \href{https://en.wikipedia.org/wiki/Symplectic_integrator}{symplectic integrator}), diff --git a/man/PPC-censoring.Rd b/man/PPC-censoring.Rd index 68026b20..5dcb30e1 100644 --- a/man/PPC-censoring.Rd +++ b/man/PPC-censoring.Rd @@ -13,7 +13,8 @@ ppc_km_overlay( status_y, left_truncation_y = NULL, extrapolation_factor = 1.2, - size = 0.25, + size = NULL, + linewidth = 0.25, alpha = 0.7 ) @@ -25,7 +26,8 @@ ppc_km_overlay_grouped( status_y, left_truncation_y = NULL, extrapolation_factor = 1.2, - size = 0.25, + size = NULL, + linewidth = 0.25, alpha = 0.7 ) } @@ -59,8 +61,8 @@ posterior predictive draws may not be shown by default because of the controlled extrapolation. To display all posterior predictive draws, set \code{extrapolation_factor = Inf}.} -\item{size, alpha}{Passed to the appropriate geom to control the appearance of -the \code{yrep} distributions.} +\item{size, alpha, linewidth}{Passed to the appropriate geom to control the +appearance of the \code{yrep} distributions.} \item{group}{A grouping variable of the same length as \code{y}. Will be coerced to \link[base:factor]{factor} if not already a factor. diff --git a/man/PPC-discrete.Rd b/man/PPC-discrete.Rd index 5f832a78..dc94706f 100644 --- a/man/PPC-discrete.Rd +++ b/man/PPC-discrete.Rd @@ -16,7 +16,7 @@ ppc_bars( prob = 0.9, width = 0.9, size = 1, - fatten = 2.5, + fatten = deprecated(), linewidth = 1, freq = TRUE ) @@ -30,7 +30,7 @@ ppc_bars_grouped( prob = 0.9, width = 0.9, size = 1, - fatten = 2.5, + fatten = deprecated(), linewidth = 1, freq = TRUE ) @@ -81,11 +81,14 @@ of the expected counts.)} \item{width}{For bar plots only, passed to \code{\link[ggplot2:geom_bar]{ggplot2::geom_bar()}} to control the bar width.} -\item{size, fatten, linewidth}{For bar plots, \code{size}, \code{fatten}, and \code{linewidth} -are passed to \code{\link[ggplot2:geom_linerange]{ggplot2::geom_pointrange()}} to control the appearance of the -\code{yrep} points and intervals. For rootograms \code{size} is passed to +\item{size, linewidth}{For bar plots, \code{size} and \code{linewidth} are passed to +\code{\link[ggplot2:geom_linerange]{ggplot2::geom_pointrange()}} to control the appearance of the \code{yrep} points +and intervals, where \code{size} controls the point size and \code{linewidth} controls +the line width. For rootograms \code{size} is passed to \code{\link[ggplot2:geom_path]{ggplot2::geom_line()}} and \code{\link[ggplot2:geom_linerange]{ggplot2::geom_pointrange()}}.} +\item{fatten}{Deprecated. Point size is now controlled directly by \code{size}.} + \item{freq}{For bar plots only, if \code{TRUE} (the default) the y-axis will display counts. Setting \code{freq=FALSE} will put proportions on the y-axis.} @@ -250,7 +253,6 @@ ppc_bars_grouped( group = esoph$agegp, freq=FALSE, prob = 0.5, - fatten = 1, size = 1.5 ) } diff --git a/man/PPC-distributions.Rd b/man/PPC-distributions.Rd index 1aed7318..2ba6e34c 100644 --- a/man/PPC-distributions.Rd +++ b/man/PPC-distributions.Rd @@ -24,7 +24,8 @@ ppc_dens_overlay( y, yrep, ..., - size = 0.25, + size = NULL, + linewidth = 0.25, alpha = 0.7, trim = FALSE, bw = "nrd0", @@ -39,7 +40,8 @@ ppc_dens_overlay_grouped( yrep, group, ..., - size = 0.25, + size = NULL, + linewidth = 0.25, alpha = 0.7, trim = FALSE, bw = "nrd0", @@ -55,7 +57,8 @@ ppc_ecdf_overlay( ..., discrete = deprecated(), pad = TRUE, - size = 0.25, + size = NULL, + linewidth = 0.25, alpha = 0.7 ) @@ -66,11 +69,21 @@ ppc_ecdf_overlay_grouped( ..., discrete = deprecated(), pad = TRUE, - size = 0.25, + size = NULL, + linewidth = 0.25, alpha = 0.7 ) -ppc_dens(y, yrep, ..., trim = FALSE, size = 0.5, alpha = 1, bounds = NULL) +ppc_dens( + y, + yrep, + ..., + trim = FALSE, + size = NULL, + linewidth = 0.5, + alpha = 1, + bounds = NULL +) ppc_hist( y, @@ -89,7 +102,8 @@ ppc_freqpoly( binwidth = NULL, bins = NULL, freq = TRUE, - size = 0.5, + size = NULL, + linewidth = 0.5, alpha = 1 ) @@ -101,11 +115,20 @@ ppc_freqpoly_grouped( binwidth = NULL, bins = NULL, freq = TRUE, - size = 0.5, + size = NULL, + linewidth = 0.5, alpha = 1 ) -ppc_boxplot(y, yrep, ..., notch = TRUE, size = 0.5, alpha = 1) +ppc_boxplot( + y, + yrep, + ..., + notch = TRUE, + size = NULL, + linewidth = 0.5, + alpha = 1 +) ppc_dots(y, yrep, ..., binwidth = NA, quantiles = 100, freq = TRUE) @@ -115,7 +138,8 @@ ppc_violin_grouped( group, ..., probs = c(0.1, 0.5, 0.9), - size = 1, + size = NULL, + linewidth = 1, alpha = 1, y_draw = c("violin", "points", "both"), y_size = 1, @@ -165,8 +189,11 @@ to the corresponding observation.} \item{...}{For dot plots, optional additional arguments to pass to \code{\link[ggdist:stat_dots]{ggdist::stat_dots()}}.} -\item{size, alpha}{Passed to the appropriate geom to control the appearance of -the predictive distributions.} +\item{size}{Deprecated for line-width control. Use \code{linewidth} instead.} + +\item{linewidth, alpha}{Passed to the appropriate geom to control the +appearance of the predictive distributions. For overlay and density-type +plots, \code{linewidth} controls the line width.} \item{trim}{A logical scalar passed to \code{\link[ggplot2:geom_density]{ggplot2::geom_density()}}.} @@ -348,7 +375,7 @@ ppc_dots(y, yrep[1:8, ]) \donttest{ # frequency polygons -ppc_freqpoly(y, yrep[1:3, ], alpha = 0.1, size = 1, binwidth = 5) +ppc_freqpoly(y, yrep[1:3, ], alpha = 0.1, linewidth = 1, binwidth = 5) ppc_freqpoly_grouped(y, yrep[1:3, ], group) + yaxis_text() @@ -371,7 +398,7 @@ ppc_pit_ecdf_grouped(y, yrep, group=group, prob=0.99) # don't need to only use small number of rows for ppc_violin_grouped # (as it pools yrep draws within groups) color_scheme_set("gray") -ppc_violin_grouped(y, yrep, group, size = 1.5) +ppc_violin_grouped(y, yrep, group, linewidth = 1.5) ppc_violin_grouped(y, yrep, group, alpha = 0) # change how y is drawn diff --git a/man/PPC-errors.Rd b/man/PPC-errors.Rd index f3931c26..9f8f53b4 100644 --- a/man/PPC-errors.Rd +++ b/man/PPC-errors.Rd @@ -75,7 +75,8 @@ ppc_error_binned( ..., facet_args = list(), bins = NULL, - size = 1, + size = NULL, + linewidth = 1, alpha = 0.25 ) @@ -131,6 +132,8 @@ opacity of the shaded region indicating the 2-SE bounds.} posterior average. In both cases, the function should take a vector input and return a scalar statistic. The function name is displayed in the axis-label. Defaults to \code{"mean"}.} + +\item{linewidth}{For the binned error plot, the line width of the outline.} } \value{ The plotting functions return a ggplot object that can be further diff --git a/man/PPC-intervals.Rd b/man/PPC-intervals.Rd index 5b3bea32..5918b314 100644 --- a/man/PPC-intervals.Rd +++ b/man/PPC-intervals.Rd @@ -19,7 +19,7 @@ ppc_intervals( prob_outer = 0.9, alpha = 0.33, size = 1, - fatten = 2.5, + fatten = deprecated(), linewidth = 1 ) @@ -34,7 +34,7 @@ ppc_intervals_grouped( prob_outer = 0.9, alpha = 0.33, size = 1, - fatten = 2.5, + fatten = deprecated(), linewidth = 1 ) @@ -46,7 +46,8 @@ ppc_ribbon( prob = 0.5, prob_outer = 0.9, alpha = 0.33, - size = 0.25, + size = NULL, + linewidth = 0.25, y_draw = c("line", "points", "both") ) @@ -60,7 +61,8 @@ ppc_ribbon_grouped( prob = 0.5, prob_outer = 0.9, alpha = 0.33, - size = 0.25, + size = NULL, + linewidth = 0.25, y_draw = c("line", "points", "both") ) @@ -107,13 +109,15 @@ is missing or \code{NULL} then the observation index is used for the x-axis.} probability mass to include in the inner and outer intervals. The defaults are \code{prob=0.5} and \code{prob_outer=0.9}.} -\item{alpha, size, fatten, linewidth}{Arguments passed to geoms. For ribbon -plots \code{alpha} is passed to \code{\link[ggplot2:geom_ribbon]{ggplot2::geom_ribbon()}} to control the opacity -of the outer ribbon and \code{size} is passed to \code{\link[ggplot2:geom_path]{ggplot2::geom_line()}} to -control the size of the line representing the median prediction (\code{size=0} -will remove the line). For interval plots \code{alpha}, \code{size}, \code{fatten}, and -\code{linewidth} are passed to \code{\link[ggplot2:geom_linerange]{ggplot2::geom_pointrange()}} (\code{fatten=0} will -remove the point estimates).} +\item{alpha, size, linewidth}{Arguments passed to geoms. For ribbon plots +\code{alpha} is passed to \code{\link[ggplot2:geom_ribbon]{ggplot2::geom_ribbon()}} to control the opacity of the +outer ribbon and \code{linewidth} is passed to \code{\link[ggplot2:geom_path]{ggplot2::geom_line()}} to control +the width of the line representing the median prediction (\code{linewidth=0} +will remove the line). For interval plots \code{alpha}, \code{size}, and \code{linewidth} +are passed to \code{\link[ggplot2:geom_linerange]{ggplot2::geom_pointrange()}} where \code{size} controls the point +size and \code{linewidth} controls the line width.} + +\item{fatten}{Deprecated. Point size is now controlled directly by \code{size}.} \item{group}{A grouping variable of the same length as \code{y}. Will be coerced to \link[base:factor]{factor} if not already a factor. @@ -181,11 +185,11 @@ ppc_ribbon(y, yrep, y_draw = "points") ppc_ribbon(y, yrep, y_draw = "both") } -ppc_intervals(y, yrep, size = 1.5, fatten = 0) # remove the yrep point estimates +ppc_intervals(y, yrep, size = 0) # remove the yrep point estimates color_scheme_set("teal") year <- 1950:1999 -ppc_intervals(y, yrep, x = year, fatten = 1) + ggplot2::xlab("Year") +ppc_intervals(y, yrep, x = year, size = 1) + ggplot2::xlab("Year") ppc_ribbon(y, yrep, x = year) + ggplot2::xlab("Year") color_scheme_set("pink") diff --git a/man/PPC-loo.Rd b/man/PPC-loo.Rd index 6c57dc5c..d77045c9 100644 --- a/man/PPC-loo.Rd +++ b/man/PPC-loo.Rd @@ -19,7 +19,8 @@ ppc_loo_pit_overlay( psis_object = NULL, pit = NULL, samples = 100, - size = 0.25, + size = NULL, + linewidth = 0.25, alpha = 0.7, boundary_correction = TRUE, grid_len = 512, @@ -90,7 +91,7 @@ ppc_loo_intervals( prob_outer = 0.9, alpha = 0.33, size = 1, - fatten = 2.5, + fatten = deprecated(), linewidth = 1, order = c("index", "median") ) @@ -105,7 +106,8 @@ ppc_loo_ribbon( prob = 0.5, prob_outer = 0.9, alpha = 0.33, - size = 0.25 + size = NULL, + linewidth = 0.25 ) } \arguments{ @@ -143,13 +145,13 @@ distribution. The default is 100. The density estimate of each dataset is plotted as a thin line in the plot, with the density estimate of the LOO PITs overlaid as a thicker dark line.} -\item{alpha, size, fatten, linewidth}{Arguments passed to code geoms to control -plot aesthetics. For \code{ppc_loo_pit_qq()} and \code{ppc_loo_pit_overlay()},\code{size} -and \code{alpha} are passed to \code{\link[ggplot2:geom_point]{ggplot2::geom_point()}} and -\code{\link[ggplot2:geom_density]{ggplot2::geom_density()}}, respectively. For \code{ppc_loo_intervals()}, \code{size} -\code{linewidth} and \code{fatten} are passed to \code{\link[ggplot2:geom_linerange]{ggplot2::geom_pointrange()}}. For -\code{ppc_loo_ribbon()}, \code{alpha} and \code{size} are passed to -\code{\link[ggplot2:geom_ribbon]{ggplot2::geom_ribbon()}}.} +\item{alpha, size, linewidth}{Arguments passed to geoms to control plot +aesthetics. For \code{ppc_loo_pit_qq()}, \code{size} and \code{alpha} are passed to +\code{\link[ggplot2:geom_point]{ggplot2::geom_point()}}. For \code{ppc_loo_pit_overlay()}, \code{linewidth} and +\code{alpha} control the line width and opacity. For \code{ppc_loo_intervals()}, +\code{size} controls the point size and \code{linewidth} controls the line width +in \code{\link[ggplot2:geom_linerange]{ggplot2::geom_pointrange()}}. For \code{ppc_loo_ribbon()}, \code{alpha} and +\code{linewidth} control the ribbon opacity and median line width.} \item{boundary_correction}{For \code{ppc_loo_pit_overlay()}, when set to \code{TRUE} (the default) the function will compute boundary corrected density values @@ -218,6 +220,8 @@ data points and five columns in the following order: lower outer interval, lower inner interval, median (50\%), upper inner interval and upper outer interval (column names are ignored).} +\item{fatten}{Deprecated. Point size is now controlled directly by \code{size}.} + \item{order}{For \code{ppc_loo_intervals()}, a string indicating how to arrange the plotted intervals. The default (\code{"index"}) is to plot them in the order of the observations. The alternative (\code{"median"}) arranges them diff --git a/man/PPD-distributions.Rd b/man/PPD-distributions.Rd index a8a7d6bf..01b4305b 100644 --- a/man/PPD-distributions.Rd +++ b/man/PPD-distributions.Rd @@ -19,7 +19,8 @@ ppd_dens_overlay( ypred, show_marginal = FALSE, ..., - size = 0.25, + size = NULL, + linewidth = 0.25, alpha = 0.7, trim = FALSE, bw = "nrd0", @@ -35,7 +36,8 @@ ppd_ecdf_overlay( ..., discrete = deprecated(), pad = TRUE, - size = 0.25, + size = NULL, + linewidth = 0.25, alpha = 0.7 ) @@ -44,7 +46,8 @@ ppd_dens( show_marginal = FALSE, ..., trim = FALSE, - size = 0.5, + size = NULL, + linewidth = 0.5, alpha = 1, bounds = NULL ) @@ -75,7 +78,8 @@ ppd_freqpoly( binwidth = NULL, bins = NULL, freq = !show_marginal, - size = 0.5, + size = NULL, + linewidth = 0.5, alpha = 1 ) @@ -87,7 +91,8 @@ ppd_freqpoly_grouped( binwidth = NULL, bins = NULL, freq = !show_marginal, - size = 0.5, + size = NULL, + linewidth = 0.5, alpha = 1 ) @@ -96,7 +101,8 @@ ppd_boxplot( show_marginal = FALSE, ..., notch = TRUE, - size = 0.5, + size = NULL, + linewidth = 0.5, alpha = 1 ) } @@ -116,8 +122,11 @@ to the corresponding observation.} \item{...}{For dot plots, optional additional arguments to pass to \code{\link[ggdist:stat_dots]{ggdist::stat_dots()}}.} -\item{size, alpha}{Passed to the appropriate geom to control the appearance of -the predictive distributions.} +\item{size}{Deprecated for line-width control. Use \code{linewidth} instead.} + +\item{linewidth, alpha}{Passed to the appropriate geom to control the +appearance of the predictive distributions. For overlay and density-type +plots, \code{linewidth} controls the line width.} \item{trim}{A logical scalar passed to \code{\link[ggplot2:geom_density]{ggplot2::geom_density()}}.} diff --git a/man/PPD-intervals.Rd b/man/PPD-intervals.Rd index edadf8e9..edeb9fa0 100644 --- a/man/PPD-intervals.Rd +++ b/man/PPD-intervals.Rd @@ -18,7 +18,7 @@ ppd_intervals( prob_outer = 0.9, alpha = 0.33, size = 1, - fatten = 2.5, + fatten = deprecated(), linewidth = 1 ) @@ -32,7 +32,7 @@ ppd_intervals_grouped( prob_outer = 0.9, alpha = 0.33, size = 1, - fatten = 2.5, + fatten = deprecated(), linewidth = 1 ) @@ -43,7 +43,8 @@ ppd_ribbon( prob = 0.5, prob_outer = 0.9, alpha = 0.33, - size = 0.25 + size = NULL, + linewidth = 0.25 ) ppd_ribbon_grouped( @@ -55,7 +56,8 @@ ppd_ribbon_grouped( prob = 0.5, prob_outer = 0.9, alpha = 0.33, - size = 0.25 + size = NULL, + linewidth = 0.25 ) ppd_intervals_data( @@ -94,13 +96,15 @@ is missing or \code{NULL} then the observation index is used for the x-axis.} probability mass to include in the inner and outer intervals. The defaults are \code{prob=0.5} and \code{prob_outer=0.9}.} -\item{alpha, size, fatten, linewidth}{Arguments passed to geoms. For ribbon -plots \code{alpha} is passed to \code{\link[ggplot2:geom_ribbon]{ggplot2::geom_ribbon()}} to control the opacity -of the outer ribbon and \code{size} is passed to \code{\link[ggplot2:geom_path]{ggplot2::geom_line()}} to -control the size of the line representing the median prediction (\code{size=0} -will remove the line). For interval plots \code{alpha}, \code{size}, \code{fatten}, and -\code{linewidth} are passed to \code{\link[ggplot2:geom_linerange]{ggplot2::geom_pointrange()}} (\code{fatten=0} will -remove the point estimates).} +\item{alpha, size, linewidth}{Arguments passed to geoms. For ribbon plots +\code{alpha} is passed to \code{\link[ggplot2:geom_ribbon]{ggplot2::geom_ribbon()}} to control the opacity of the +outer ribbon and \code{linewidth} is passed to \code{\link[ggplot2:geom_path]{ggplot2::geom_line()}} to control +the width of the line representing the median prediction (\code{linewidth=0} +will remove the line). For interval plots \code{alpha}, \code{size}, and \code{linewidth} +are passed to \code{\link[ggplot2:geom_linerange]{ggplot2::geom_pointrange()}} where \code{size} controls the point +size and \code{linewidth} controls the line width.} + +\item{fatten}{Deprecated. Point size is now controlled directly by \code{size}.} \item{group}{A grouping variable of the same length as \code{y}. Will be coerced to \link[base:factor]{factor} if not already a factor. @@ -133,12 +137,12 @@ x <- example_x_data() group <- example_group_data() ppd_intervals(ypred[, 1:50]) -ppd_intervals(ypred[, 1:50], fatten = 0) -ppd_intervals(ypred[, 1:50], fatten = 0, linewidth = 2) -ppd_intervals(ypred[, 1:50], prob_outer = 0.75, fatten = 0, linewidth = 2) +ppd_intervals(ypred[, 1:50], size = 0) +ppd_intervals(ypred[, 1:50], size = 0, linewidth = 2) +ppd_intervals(ypred[, 1:50], prob_outer = 0.75, size = 0, linewidth = 2) # put a predictor variable on the x-axis -ppd_intervals(ypred[, 1:100], x = x[1:100], fatten = 1) + +ppd_intervals(ypred[, 1:100], x = x[1:100], size = 1) + ggplot2::labs(y = "Prediction", x = "Some variable of interest") # with a grouping variable too @@ -146,16 +150,15 @@ ppd_intervals_grouped( ypred = ypred[, 1:100], x = x[1:100], group = group[1:100], - size = 2, - fatten = 0, + size = 0, facet_args = list(nrow = 2) ) # even reducing size, ppd_intervals is too cluttered when there are many # observations included (ppd_ribbon is better) -ppd_intervals(ypred, size = 0.5, fatten = 0.1, linewidth = 0.5) +ppd_intervals(ypred, size = 0.1, linewidth = 0.5) ppd_ribbon(ypred) -ppd_ribbon(ypred, size = 0) # remove line showing median prediction +ppd_ribbon(ypred, linewidth = 0) # remove line showing median prediction } \references{ diff --git a/tests/testthat/_snaps/ppc-censoring/ppc-km-overlay-grouped-size-alpha.svg b/tests/testthat/_snaps/ppc-censoring/ppc-km-overlay-grouped-linewidth-alpha.svg similarity index 99% rename from tests/testthat/_snaps/ppc-censoring/ppc-km-overlay-grouped-size-alpha.svg rename to tests/testthat/_snaps/ppc-censoring/ppc-km-overlay-grouped-linewidth-alpha.svg index 45e221ea..54d55da0 100644 --- a/tests/testthat/_snaps/ppc-censoring/ppc-km-overlay-grouped-size-alpha.svg +++ b/tests/testthat/_snaps/ppc-censoring/ppc-km-overlay-grouped-linewidth-alpha.svg @@ -128,6 +128,6 @@ r e p -ppc_km_overlay_grouped (size, alpha) +ppc_km_overlay_grouped (linewidth, alpha) diff --git a/tests/testthat/_snaps/ppc-censoring/ppc-km-overlay-size-alpha.svg b/tests/testthat/_snaps/ppc-censoring/ppc-km-overlay-linewidth-alpha.svg similarity index 98% rename from tests/testthat/_snaps/ppc-censoring/ppc-km-overlay-size-alpha.svg rename to tests/testthat/_snaps/ppc-censoring/ppc-km-overlay-linewidth-alpha.svg index 761426e9..281c4ade 100644 --- a/tests/testthat/_snaps/ppc-censoring/ppc-km-overlay-size-alpha.svg +++ b/tests/testthat/_snaps/ppc-censoring/ppc-km-overlay-linewidth-alpha.svg @@ -68,6 +68,6 @@ r e p -ppc_km_overlay (size, alpha) +ppc_km_overlay (linewidth, alpha) diff --git a/tests/testthat/_snaps/ppc-discrete/ppc-bars-default.svg b/tests/testthat/_snaps/ppc-discrete/ppc-bars-default.svg index 59b7bb7c..e1f17207 100644 --- a/tests/testthat/_snaps/ppc-discrete/ppc-bars-default.svg +++ b/tests/testthat/_snaps/ppc-discrete/ppc-bars-default.svg @@ -37,12 +37,12 @@ - - - - - - + + + + + + diff --git a/tests/testthat/_snaps/ppc-discrete/ppc-bars-grouped-default.svg b/tests/testthat/_snaps/ppc-discrete/ppc-bars-grouped-default.svg index 4be3a5a8..7f38aac5 100644 --- a/tests/testthat/_snaps/ppc-discrete/ppc-bars-grouped-default.svg +++ b/tests/testthat/_snaps/ppc-discrete/ppc-bars-grouped-default.svg @@ -37,12 +37,12 @@ - - - - - - + + + + + + @@ -66,12 +66,12 @@ - - - - - - + + + + + + diff --git a/tests/testthat/_snaps/ppc-discrete/ppc-bars-grouped-facet-args-prob-size.svg b/tests/testthat/_snaps/ppc-discrete/ppc-bars-grouped-facet-args-prob-size.svg index df089587..68fadadf 100644 --- a/tests/testthat/_snaps/ppc-discrete/ppc-bars-grouped-facet-args-prob-size.svg +++ b/tests/testthat/_snaps/ppc-discrete/ppc-bars-grouped-facet-args-prob-size.svg @@ -37,12 +37,12 @@ - - - - - - + + + + + + @@ -66,12 +66,12 @@ - - - - - - + + + + + + diff --git a/tests/testthat/_snaps/ppc-discrete/ppc-bars-prob-0-33-width-size-fatten.svg b/tests/testthat/_snaps/ppc-discrete/ppc-bars-prob-0-33-width-size.svg similarity index 91% rename from tests/testthat/_snaps/ppc-discrete/ppc-bars-prob-0-33-width-size-fatten.svg rename to tests/testthat/_snaps/ppc-discrete/ppc-bars-prob-0-33-width-size.svg index 0da7d859..e93baa5a 100644 --- a/tests/testthat/_snaps/ppc-discrete/ppc-bars-prob-0-33-width-size-fatten.svg +++ b/tests/testthat/_snaps/ppc-discrete/ppc-bars-prob-0-33-width-size.svg @@ -37,12 +37,12 @@ - - - - - - + + + + + + @@ -73,13 +73,13 @@ 5 Count - + y r e p y -ppc_bars (prob=0.33, width, size, fatten) +ppc_bars (prob=0.33, width, size) diff --git a/tests/testthat/_snaps/ppc-discrete/ppc-bars-width-size-fatten.svg b/tests/testthat/_snaps/ppc-discrete/ppc-bars-width-size.svg similarity index 90% rename from tests/testthat/_snaps/ppc-discrete/ppc-bars-width-size-fatten.svg rename to tests/testthat/_snaps/ppc-discrete/ppc-bars-width-size.svg index c0eff814..ae45d174 100644 --- a/tests/testthat/_snaps/ppc-discrete/ppc-bars-width-size-fatten.svg +++ b/tests/testthat/_snaps/ppc-discrete/ppc-bars-width-size.svg @@ -37,12 +37,12 @@ - - - - - - + + + + + + @@ -71,13 +71,13 @@ 5 Count - + y r e p y -ppc_bars (width, size, fatten) +ppc_bars (width, size) diff --git a/tests/testthat/_snaps/ppc-distributions/ppc-boxplot-alpha-size.svg b/tests/testthat/_snaps/ppc-distributions/ppc-boxplot-alpha-linewidth.svg similarity index 99% rename from tests/testthat/_snaps/ppc-distributions/ppc-boxplot-alpha-size.svg rename to tests/testthat/_snaps/ppc-distributions/ppc-boxplot-alpha-linewidth.svg index 9bb9d175..b3ca91fd 100644 --- a/tests/testthat/_snaps/ppc-distributions/ppc-boxplot-alpha-size.svg +++ b/tests/testthat/_snaps/ppc-distributions/ppc-boxplot-alpha-linewidth.svg @@ -100,6 +100,6 @@ r e p -ppc_boxplot (alpha, size) +ppc_boxplot (alpha, linewidth) diff --git a/tests/testthat/_snaps/ppc-distributions/ppc-dens-overlay-alpha-size.svg b/tests/testthat/_snaps/ppc-distributions/ppc-dens-overlay-alpha-linewidth.svg similarity index 99% rename from tests/testthat/_snaps/ppc-distributions/ppc-dens-overlay-alpha-size.svg rename to tests/testthat/_snaps/ppc-distributions/ppc-dens-overlay-alpha-linewidth.svg index d2f94500..3d9e2b61 100644 --- a/tests/testthat/_snaps/ppc-distributions/ppc-dens-overlay-alpha-size.svg +++ b/tests/testthat/_snaps/ppc-distributions/ppc-dens-overlay-alpha-linewidth.svg @@ -68,6 +68,6 @@ r e p -ppc_dens_overlay (alpha, size) +ppc_dens_overlay (alpha, linewidth) diff --git a/tests/testthat/_snaps/ppc-distributions/ppc-dens-overlay-grouped-alpha-size.svg b/tests/testthat/_snaps/ppc-distributions/ppc-dens-overlay-grouped-alpha-linewidth.svg similarity index 99% rename from tests/testthat/_snaps/ppc-distributions/ppc-dens-overlay-grouped-alpha-size.svg rename to tests/testthat/_snaps/ppc-distributions/ppc-dens-overlay-grouped-alpha-linewidth.svg index cae810c4..bb824f1c 100644 --- a/tests/testthat/_snaps/ppc-distributions/ppc-dens-overlay-grouped-alpha-size.svg +++ b/tests/testthat/_snaps/ppc-distributions/ppc-dens-overlay-grouped-alpha-linewidth.svg @@ -229,6 +229,6 @@ r e p -ppc_dens_overlay_grouped (alpha, size) +ppc_dens_overlay_grouped (alpha, linewidth) diff --git a/tests/testthat/_snaps/ppc-distributions/ppc-ecdf-overlay-grouped-size-alpha.svg b/tests/testthat/_snaps/ppc-distributions/ppc-ecdf-overlay-grouped-linewidth-alpha.svg similarity index 99% rename from tests/testthat/_snaps/ppc-distributions/ppc-ecdf-overlay-grouped-size-alpha.svg rename to tests/testthat/_snaps/ppc-distributions/ppc-ecdf-overlay-grouped-linewidth-alpha.svg index 456f6a56..22694952 100644 --- a/tests/testthat/_snaps/ppc-distributions/ppc-ecdf-overlay-grouped-size-alpha.svg +++ b/tests/testthat/_snaps/ppc-distributions/ppc-ecdf-overlay-grouped-linewidth-alpha.svg @@ -128,6 +128,6 @@ r e p -ppc_ecdf_overlay_grouped (size, alpha) +ppc_ecdf_overlay_grouped (linewidth, alpha) diff --git a/tests/testthat/_snaps/ppc-distributions/ppc-ecdf-overlay-size-alpha.svg b/tests/testthat/_snaps/ppc-distributions/ppc-ecdf-overlay-linewidth-alpha.svg similarity index 98% rename from tests/testthat/_snaps/ppc-distributions/ppc-ecdf-overlay-size-alpha.svg rename to tests/testthat/_snaps/ppc-distributions/ppc-ecdf-overlay-linewidth-alpha.svg index 110688d4..8b37f9f4 100644 --- a/tests/testthat/_snaps/ppc-distributions/ppc-ecdf-overlay-size-alpha.svg +++ b/tests/testthat/_snaps/ppc-distributions/ppc-ecdf-overlay-linewidth-alpha.svg @@ -68,6 +68,6 @@ r e p -ppc_ecdf_overlay (size, alpha) +ppc_ecdf_overlay (linewidth, alpha) diff --git a/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-alpha-binwidth-size.svg b/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-alpha-binwidth-linewidth.svg similarity index 99% rename from tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-alpha-binwidth-size.svg rename to tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-alpha-binwidth-linewidth.svg index 6b4bd675..a079ce7b 100644 --- a/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-alpha-binwidth-size.svg +++ b/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-alpha-binwidth-linewidth.svg @@ -180,6 +180,6 @@ r e p -ppc_freqpoly (alpha, binwidth, size) +ppc_freqpoly (alpha, binwidth, linewidth) diff --git a/tests/testthat/_snaps/ppc-distributions/ppd-boxplot-alpha-size.svg b/tests/testthat/_snaps/ppc-distributions/ppd-boxplot-alpha-linewidth.svg similarity index 98% rename from tests/testthat/_snaps/ppc-distributions/ppd-boxplot-alpha-size.svg rename to tests/testthat/_snaps/ppc-distributions/ppd-boxplot-alpha-linewidth.svg index a73bf088..1abbd6e5 100644 --- a/tests/testthat/_snaps/ppc-distributions/ppd-boxplot-alpha-size.svg +++ b/tests/testthat/_snaps/ppc-distributions/ppd-boxplot-alpha-linewidth.svg @@ -79,6 +79,6 @@ -ppd_boxplot (alpha, size) +ppd_boxplot (alpha, linewidth) diff --git a/tests/testthat/_snaps/ppc-distributions/ppd-dens-overlay-alpha-size.svg b/tests/testthat/_snaps/ppc-distributions/ppd-dens-overlay-alpha-linewidth.svg similarity index 99% rename from tests/testthat/_snaps/ppc-distributions/ppd-dens-overlay-alpha-size.svg rename to tests/testthat/_snaps/ppc-distributions/ppd-dens-overlay-alpha-linewidth.svg index b7098aea..2eafcdd7 100644 --- a/tests/testthat/_snaps/ppc-distributions/ppd-dens-overlay-alpha-size.svg +++ b/tests/testthat/_snaps/ppc-distributions/ppd-dens-overlay-alpha-linewidth.svg @@ -60,6 +60,6 @@ -2 0 2 -ppd_dens_overlay (alpha, size) +ppd_dens_overlay (alpha, linewidth) diff --git a/tests/testthat/_snaps/ppc-distributions/ppd-freqpoly-alpha-binwidth-size.svg b/tests/testthat/_snaps/ppc-distributions/ppd-freqpoly-alpha-binwidth-linewidth.svg similarity index 99% rename from tests/testthat/_snaps/ppc-distributions/ppd-freqpoly-alpha-binwidth-size.svg rename to tests/testthat/_snaps/ppc-distributions/ppd-freqpoly-alpha-binwidth-linewidth.svg index 53968e83..1e913cdf 100644 --- a/tests/testthat/_snaps/ppc-distributions/ppd-freqpoly-alpha-binwidth-size.svg +++ b/tests/testthat/_snaps/ppc-distributions/ppd-freqpoly-alpha-binwidth-linewidth.svg @@ -158,6 +158,6 @@ -ppd_freqpoly (alpha, binwidth, size) +ppd_freqpoly (alpha, binwidth, linewidth) diff --git a/tests/testthat/_snaps/ppc-intervals/ppc-intervals-default.svg b/tests/testthat/_snaps/ppc-intervals/ppc-intervals-default.svg index 8ff083cb..5bba8442 100644 --- a/tests/testthat/_snaps/ppc-intervals/ppc-intervals-default.svg +++ b/tests/testthat/_snaps/ppc-intervals/ppc-intervals-default.svg @@ -225,106 +225,106 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/testthat/_snaps/ppc-intervals/ppc-intervals-grouped-default.svg b/tests/testthat/_snaps/ppc-intervals/ppc-intervals-grouped-default.svg index e37ee1a9..64a9f9bb 100644 --- a/tests/testthat/_snaps/ppc-intervals/ppc-intervals-grouped-default.svg +++ b/tests/testthat/_snaps/ppc-intervals/ppc-intervals-grouped-default.svg @@ -75,31 +75,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -186,31 +186,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -297,31 +297,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -408,31 +408,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/testthat/_snaps/ppc-intervals/ppc-intervals-grouped-x-values.svg b/tests/testthat/_snaps/ppc-intervals/ppc-intervals-grouped-x-values.svg index 9c418024..ca137938 100644 --- a/tests/testthat/_snaps/ppc-intervals/ppc-intervals-grouped-x-values.svg +++ b/tests/testthat/_snaps/ppc-intervals/ppc-intervals-grouped-x-values.svg @@ -75,31 +75,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -186,31 +186,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -297,31 +297,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -408,31 +408,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/testthat/_snaps/ppc-intervals/ppc-intervals-interval-width.svg b/tests/testthat/_snaps/ppc-intervals/ppc-intervals-interval-width.svg index 8fcd3900..171baf8e 100644 --- a/tests/testthat/_snaps/ppc-intervals/ppc-intervals-interval-width.svg +++ b/tests/testthat/_snaps/ppc-intervals/ppc-intervals-interval-width.svg @@ -225,106 +225,106 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/testthat/_snaps/ppc-intervals/ppc-intervals-x-values.svg b/tests/testthat/_snaps/ppc-intervals/ppc-intervals-x-values.svg index b2be547c..96db87c0 100644 --- a/tests/testthat/_snaps/ppc-intervals/ppc-intervals-x-values.svg +++ b/tests/testthat/_snaps/ppc-intervals/ppc-intervals-x-values.svg @@ -225,106 +225,106 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/testthat/_snaps/ppc-intervals/ppd-intervals-default.svg b/tests/testthat/_snaps/ppc-intervals/ppd-intervals-default.svg index f401a74b..bb2fde7b 100644 --- a/tests/testthat/_snaps/ppc-intervals/ppd-intervals-default.svg +++ b/tests/testthat/_snaps/ppc-intervals/ppd-intervals-default.svg @@ -225,106 +225,106 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/testthat/_snaps/ppc-intervals/ppd-intervals-grouped-default.svg b/tests/testthat/_snaps/ppc-intervals/ppd-intervals-grouped-default.svg index 4a443550..f770ecdd 100644 --- a/tests/testthat/_snaps/ppc-intervals/ppd-intervals-grouped-default.svg +++ b/tests/testthat/_snaps/ppc-intervals/ppd-intervals-grouped-default.svg @@ -75,31 +75,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -161,31 +161,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -247,31 +247,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -333,31 +333,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/testthat/_snaps/ppc-intervals/ppd-intervals-grouped-x-values.svg b/tests/testthat/_snaps/ppc-intervals/ppd-intervals-grouped-x-values.svg index bcbbdfb8..f9796706 100644 --- a/tests/testthat/_snaps/ppc-intervals/ppd-intervals-grouped-x-values.svg +++ b/tests/testthat/_snaps/ppc-intervals/ppd-intervals-grouped-x-values.svg @@ -75,31 +75,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -161,31 +161,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -247,31 +247,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -333,31 +333,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/testthat/_snaps/ppc-intervals/ppd-intervals-interval-width.svg b/tests/testthat/_snaps/ppc-intervals/ppd-intervals-interval-width.svg index 16b407d8..5bc321aa 100644 --- a/tests/testthat/_snaps/ppc-intervals/ppd-intervals-interval-width.svg +++ b/tests/testthat/_snaps/ppc-intervals/ppd-intervals-interval-width.svg @@ -225,106 +225,106 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/testthat/_snaps/ppc-intervals/ppd-intervals-x-values.svg b/tests/testthat/_snaps/ppc-intervals/ppd-intervals-x-values.svg index 6b97f063..b4af8483 100644 --- a/tests/testthat/_snaps/ppc-intervals/ppd-intervals-x-values.svg +++ b/tests/testthat/_snaps/ppc-intervals/ppd-intervals-x-values.svg @@ -225,106 +225,106 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/testthat/_snaps/ppc-loo/ppc-loo-intervals-default.svg b/tests/testthat/_snaps/ppc-loo/ppc-loo-intervals-default.svg index 5bf8efc8..0c357a74 100644 --- a/tests/testthat/_snaps/ppc-loo/ppc-loo-intervals-default.svg +++ b/tests/testthat/_snaps/ppc-loo/ppc-loo-intervals-default.svg @@ -225,106 +225,106 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/testthat/_snaps/ppc-loo/ppc-loo-intervals-order.svg b/tests/testthat/_snaps/ppc-loo/ppc-loo-intervals-order.svg index 98aaf8cc..8d868134 100644 --- a/tests/testthat/_snaps/ppc-loo/ppc-loo-intervals-order.svg +++ b/tests/testthat/_snaps/ppc-loo/ppc-loo-intervals-order.svg @@ -225,106 +225,106 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/testthat/_snaps/ppc-loo/ppc-loo-intervals-prob.svg b/tests/testthat/_snaps/ppc-loo/ppc-loo-intervals-prob.svg index 9aec7108..8ad71c9c 100644 --- a/tests/testthat/_snaps/ppc-loo/ppc-loo-intervals-prob.svg +++ b/tests/testthat/_snaps/ppc-loo/ppc-loo-intervals-prob.svg @@ -225,106 +225,106 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/testthat/_snaps/ppd-marginal/ppd-boxplot-marginal.svg b/tests/testthat/_snaps/ppd-marginal/ppd-boxplot-marginal.svg index b8a6a795..0068a1a2 100644 --- a/tests/testthat/_snaps/ppd-marginal/ppd-boxplot-marginal.svg +++ b/tests/testthat/_snaps/ppd-marginal/ppd-boxplot-marginal.svg @@ -77,10 +77,10 @@ - - - - + + + + @@ -91,12 +91,12 @@ - - - - - - + + + + + + diff --git a/tests/testthat/_snaps/ppd-marginal/ppd-dens-marginal.svg b/tests/testthat/_snaps/ppd-marginal/ppd-dens-marginal.svg index d12852f8..ab9dabde 100644 --- a/tests/testthat/_snaps/ppd-marginal/ppd-dens-marginal.svg +++ b/tests/testthat/_snaps/ppd-marginal/ppd-dens-marginal.svg @@ -28,7 +28,7 @@ - + @@ -159,7 +159,7 @@ - + PPD y diff --git a/tests/testthat/_snaps/ppd-marginal/ppd-freqpoly-grouped-marginal.svg b/tests/testthat/_snaps/ppd-marginal/ppd-freqpoly-grouped-marginal.svg index 98ad2942..21702eb7 100644 --- a/tests/testthat/_snaps/ppd-marginal/ppd-freqpoly-grouped-marginal.svg +++ b/tests/testthat/_snaps/ppd-marginal/ppd-freqpoly-grouped-marginal.svg @@ -28,7 +28,7 @@ - + @@ -88,7 +88,7 @@ - + @@ -148,7 +148,7 @@ - + @@ -208,7 +208,7 @@ - + @@ -352,7 +352,7 @@ - + PPD y diff --git a/tests/testthat/_snaps/ppd-marginal/ppd-freqpoly-marginal.svg b/tests/testthat/_snaps/ppd-marginal/ppd-freqpoly-marginal.svg index 56733a8b..5505aa82 100644 --- a/tests/testthat/_snaps/ppd-marginal/ppd-freqpoly-marginal.svg +++ b/tests/testthat/_snaps/ppd-marginal/ppd-freqpoly-marginal.svg @@ -28,7 +28,7 @@ - + @@ -159,7 +159,7 @@ - + PPD y diff --git a/tests/testthat/test-ppc-censoring.R b/tests/testthat/test-ppc-censoring.R index 2224df7b..c315e252 100644 --- a/tests/testthat/test-ppc-censoring.R +++ b/tests/testthat/test-ppc-censoring.R @@ -2,8 +2,8 @@ source(test_path("data-for-ppc-tests.R")) test_that("ppc_km_overlay returns a ggplot object", { skip_if_not_installed("ggfortify") - expect_gg(ppc_km_overlay(y, yrep, status_y = status_y, left_truncation_y = left_truncation_y, size = 0.5, alpha = 0.2, extrapolation_factor = Inf)) - expect_gg(ppc_km_overlay(y, yrep, status_y = status_y, left_truncation_y = left_truncation_y, size = 0.5, alpha = 0.2, extrapolation_factor = 1)) + expect_gg(ppc_km_overlay(y, yrep, status_y = status_y, left_truncation_y = left_truncation_y, linewidth = 0.5, alpha = 0.2, extrapolation_factor = Inf)) + expect_gg(ppc_km_overlay(y, yrep, status_y = status_y, left_truncation_y = left_truncation_y, linewidth = 0.5, alpha = 0.2, extrapolation_factor = 1)) expect_gg(ppc_km_overlay(y2, yrep2, status_y = status_y2)) }) @@ -12,15 +12,15 @@ test_that("ppc_km_overlay_grouped returns a ggplot object", { expect_gg(ppc_km_overlay_grouped(y, yrep, group, status_y = status_y, left_truncation_y = left_truncation_y, - size = 0.5, alpha = 0.2)) + linewidth = 0.5, alpha = 0.2)) expect_gg(ppc_km_overlay_grouped(y, yrep, as.numeric(group), status_y = status_y, left_truncation_y = left_truncation_y, - size = 0.5, alpha = 0.2)) + linewidth = 0.5, alpha = 0.2)) expect_gg(ppc_km_overlay_grouped(y, yrep, as.integer(group), status_y = status_y, left_truncation_y = left_truncation_y, - size = 0.5, alpha = 0.2)) + linewidth = 0.5, alpha = 0.2)) expect_gg(ppc_km_overlay_grouped(y2, yrep2, group2, status_y = status_y2)) @@ -89,9 +89,9 @@ test_that("ppc_km_overlay renders correctly", { vdiff_y2, vdiff_yrep2, status_y = vdiff_status_y2, - size = 2, + linewidth = 2, alpha = .2) - vdiffr::expect_doppelganger("ppc_km_overlay (size, alpha)", p_custom) + vdiffr::expect_doppelganger("ppc_km_overlay (linewidth, alpha)", p_custom) p_base2 <- ppc_km_overlay(vdiff_y3, vdiff_yrep3, status_y = vdiff_status_y3) vdiffr::expect_doppelganger("ppc_km_overlay (default 2)", p_base2) @@ -138,12 +138,12 @@ test_that("ppc_km_overlay_grouped renders correctly", { vdiff_yrep2, vdiff_group2, status_y = vdiff_status_y2, - size = 2, + linewidth = 2, alpha = .2 ) vdiffr::expect_doppelganger( - "ppc_km_overlay_grouped (size, alpha)", + "ppc_km_overlay_grouped (linewidth, alpha)", p_custom ) diff --git a/tests/testthat/test-ppc-discrete.R b/tests/testthat/test-ppc-discrete.R index 8cd20f57..343d1429 100644 --- a/tests/testthat/test-ppc-discrete.R +++ b/tests/testthat/test-ppc-discrete.R @@ -147,12 +147,11 @@ test_that("ppc_bars renders correctly", { y = vdiff_y2, yrep = vdiff_yrep2, width = 0.5, - size = 0.5, - fatten = 5 + size = 2.5 ) vdiffr::expect_doppelganger( - title = "ppc_bars (width, size, fatten)", + title = "ppc_bars (width, size)", fig = p_custom) p_custom_prob <- ppc_bars( @@ -160,12 +159,11 @@ test_that("ppc_bars renders correctly", { yrep = vdiff_yrep2, prob = 0.33, width = 0.5, - size = 0.5, - fatten = 5 + size = 2.5 ) vdiffr::expect_doppelganger( - title = "ppc_bars (prob=0.33, width, size, fatten)", + title = "ppc_bars (prob=0.33, width, size)", fig = p_custom_prob) }) diff --git a/tests/testthat/test-ppc-distributions.R b/tests/testthat/test-ppc-distributions.R index c8e3faa5..e4cb3816 100644 --- a/tests/testthat/test-ppc-distributions.R +++ b/tests/testthat/test-ppc-distributions.R @@ -2,11 +2,11 @@ source(test_path("data-for-ppc-tests.R")) test_that("ppc_dens_overlay returns a ggplot object", { expect_gg(ppc_dens_overlay(y, yrep)) - expect_gg(ppc_dens_overlay(y2, yrep2, size = 0.5, alpha = 0.2)) + expect_gg(ppc_dens_overlay(y2, yrep2, linewidth = 0.5, alpha = 0.2)) # ppd versions expect_gg(ppd_dens_overlay(yrep)) - expect_gg(ppd_dens_overlay(yrep2, size = 0.5, alpha = 0.2)) + expect_gg(ppd_dens_overlay(yrep2, linewidth = 0.5, alpha = 0.2)) }) test_that("density PPC/PPD plots accept bounds", { @@ -42,11 +42,11 @@ test_that("density PPC/PPD plots reject invalid bounds", { }) test_that("ppc_ecdf_overlay returns a ggplot object", { - expect_gg(ppc_ecdf_overlay(y, yrep, size = 0.5, alpha = 0.2)) + expect_gg(ppc_ecdf_overlay(y, yrep, linewidth = 0.5, alpha = 0.2)) expect_gg(ppc_ecdf_overlay(y2, yrep2)) # ppd versions - expect_gg(ppd_ecdf_overlay(yrep, size = 0.5, alpha = 0.2)) + expect_gg(ppd_ecdf_overlay(yrep, linewidth = 0.5, alpha = 0.2)) expect_gg(ppd_ecdf_overlay(yrep2)) }) @@ -74,7 +74,7 @@ test_that("ppc_dens,pp_hist,ppc_freqpoly,ppc_boxplot return ggplot objects", { expect_gg(ppc_dens(y, yrep[1:8, ])) expect_gg(ppc_dens(y2, yrep2)) - expect_gg(ppc_freqpoly(y, yrep[1:8, ], binwidth = 2, size = 2, alpha = 0.1)) + expect_gg(ppc_freqpoly(y, yrep[1:8, ], binwidth = 2, linewidth = 2, alpha = 0.1)) expect_gg(ppc_freqpoly(y2, yrep2, binwidth = 0.1)) expect_gg(ppc_boxplot(y, yrep[1,, drop = FALSE])) @@ -95,7 +95,7 @@ test_that("ppc_dens,pp_hist,ppc_freqpoly,ppc_boxplot return ggplot objects", { expect_gg(ppd_dens(yrep[1:8, ])) expect_gg(ppd_dens(yrep2)) - expect_gg(ppd_freqpoly(yrep[1:8, ], binwidth = 2, size = 2, alpha = 0.1)) + expect_gg(ppd_freqpoly(yrep[1:8, ], binwidth = 2, linewidth = 2, alpha = 0.1)) expect_gg(ppd_freqpoly(yrep2, binwidth = 0.1)) expect_gg(ppd_boxplot(yrep[1,, drop = FALSE])) @@ -279,10 +279,10 @@ test_that("ppc_freqpoly renders correctly", { y = vdiff_y, yrep = vdiff_yrep[1:8, ], binwidth = 2, - size = 2, + linewidth = 2, alpha = 0.1) vdiffr::expect_doppelganger( - title = "ppc_freqpoly (alpha, binwidth, size)", + title = "ppc_freqpoly (alpha, binwidth, linewidth)", fig = p_custom) # ppd versions @@ -292,10 +292,10 @@ test_that("ppc_freqpoly renders correctly", { p_custom <- ppd_freqpoly( ypred = vdiff_yrep[1:8, ], binwidth = 2, - size = 2, + linewidth = 2, alpha = 0.1) vdiffr::expect_doppelganger( - title = "ppd_freqpoly (alpha, binwidth, size)", + title = "ppd_freqpoly (alpha, binwidth, linewidth)", fig = p_custom) }) @@ -323,8 +323,8 @@ test_that("ppc_boxplot renders correctly", { p_no_notch <- ppc_boxplot(vdiff_y, vdiff_yrep[1:8, ], notch = FALSE) vdiffr::expect_doppelganger("ppc_boxplot (no notch)", p_no_notch) - p_custom <- ppc_boxplot(vdiff_y, vdiff_yrep[1:8, ], size = 1.5, alpha = .5) - vdiffr::expect_doppelganger("ppc_boxplot (alpha, size)", p_custom) + p_custom <- ppc_boxplot(vdiff_y, vdiff_yrep[1:8, ], linewidth = 1.5, alpha = .5) + vdiffr::expect_doppelganger("ppc_boxplot (alpha, linewidth)", p_custom) # ppd versions p_base <- ppd_boxplot(vdiff_yrep[1:8, ]) @@ -333,8 +333,8 @@ test_that("ppc_boxplot renders correctly", { p_no_notch <- ppd_boxplot(vdiff_yrep[1:8, ], notch = FALSE) vdiffr::expect_doppelganger("ppd_boxplot (no notch)", p_no_notch) - p_custom <- ppd_boxplot(vdiff_yrep[1:8, ], size = 1.5, alpha = .5) - vdiffr::expect_doppelganger("ppd_boxplot (alpha, size)", p_custom) + p_custom <- ppd_boxplot(vdiff_yrep[1:8, ], linewidth = 1.5, alpha = .5) + vdiffr::expect_doppelganger("ppd_boxplot (alpha, linewidth)", p_custom) }) test_that("ppc_dots renders correctly", { @@ -384,12 +384,12 @@ test_that("ppc_ecdf_overlay renders correctly", { p_custom <- ppc_ecdf_overlay( vdiff_y2, vdiff_yrep2, - size = 2, + linewidth = 2, alpha = .2 ) vdiffr::expect_doppelganger( - "ppc_ecdf_overlay (size, alpha)", + "ppc_ecdf_overlay (linewidth, alpha)", p_custom ) }) @@ -406,12 +406,12 @@ test_that("ppc_ecdf_overlay_grouped renders correctly", { vdiff_y2, vdiff_yrep2, vdiff_group2, - size = 2, + linewidth = 2, alpha = .2 ) vdiffr::expect_doppelganger( - "ppc_ecdf_overlay_grouped (size, alpha)", + "ppc_ecdf_overlay_grouped (linewidth, alpha)", p_custom ) }) @@ -446,8 +446,8 @@ test_that("ppc_dens_overlay renders correctly", { p_base <- ppc_dens_overlay(vdiff_y, vdiff_yrep) vdiffr::expect_doppelganger("ppc_dens_overlay (default)", p_base) - p_custom <- ppc_dens_overlay(vdiff_y, vdiff_yrep, size = 1, alpha = 0.2) - vdiffr::expect_doppelganger("ppc_dens_overlay (alpha, size)", p_custom) + p_custom <- ppc_dens_overlay(vdiff_y, vdiff_yrep, linewidth = 1, alpha = 0.2) + vdiffr::expect_doppelganger("ppc_dens_overlay (alpha, linewidth)", p_custom) p_bounds <- suppressWarnings(ppc_dens_overlay(vdiff_y, vdiff_yrep, bounds = c(0, Inf))) suppressWarnings(vdiffr::expect_doppelganger("ppc_dens_overlay (bounds)", p_bounds)) @@ -456,8 +456,8 @@ test_that("ppc_dens_overlay renders correctly", { p_base <- ppd_dens_overlay(vdiff_yrep) vdiffr::expect_doppelganger("ppd_dens_overlay (default)", p_base) - p_custom <- ppd_dens_overlay(vdiff_yrep, size = 1, alpha = 0.2) - vdiffr::expect_doppelganger("ppd_dens_overlay (alpha, size)", p_custom) + p_custom <- ppd_dens_overlay(vdiff_yrep, linewidth = 1, alpha = 0.2) + vdiffr::expect_doppelganger("ppd_dens_overlay (alpha, linewidth)", p_custom) p_bounds <- suppressWarnings(ppd_dens_overlay(vdiff_yrep, bounds = c(0, Inf))) suppressWarnings(vdiffr::expect_doppelganger("ppd_dens_overlay (bounds)", p_bounds)) @@ -475,12 +475,12 @@ test_that("ppc_dens_overlay_grouped renders correctly", { vdiff_y, vdiff_yrep, vdiff_group, - size = 1, + linewidth = 1, alpha = 0.2 ) vdiffr::expect_doppelganger( - "ppc_dens_overlay_grouped (alpha, size)", + "ppc_dens_overlay_grouped (alpha, linewidth)", p_custom ) }) diff --git a/tests/testthat/test-ppc-intervals.R b/tests/testthat/test-ppc-intervals.R index e40b66fc..b7b81471 100644 --- a/tests/testthat/test-ppc-intervals.R +++ b/tests/testthat/test-ppc-intervals.R @@ -2,7 +2,7 @@ source(test_path("data-for-ppc-tests.R")) test_that("ppc_intervals returns ggplot object", { expect_gg(ppc_intervals(y, yrep)) - expect_gg(ppc_intervals(y, yrep, size = 2, fatten = 1)) + expect_gg(ppc_intervals(y, yrep, size = 2)) expect_gg(ppc_intervals(y, yrep, x = seq(1, 2 * length(y), by = 2))) expect_gg(ppc_intervals(y2, yrep2)) @@ -13,7 +13,7 @@ test_that("ppc_intervals returns ggplot object", { test_that("ppc_ribbon returns ggplot object", { expect_gg(ppc_ribbon(y, yrep, prob = 0.5)) - expect_gg(ppc_ribbon(y, yrep, alpha = 0, size = .5)) + expect_gg(ppc_ribbon(y, yrep, alpha = 0, linewidth = .5)) expect_gg(ppc_ribbon(y2, yrep2, x = rnorm(length(y2)), prob = 0.5)) # ppd versions