diff --git a/DESCRIPTION b/DESCRIPTION
index 9f47b08b..6b28a199 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -34,6 +34,7 @@ Imports:
ggplot2 (>= 3.4.0),
ggridges (>= 0.5.5),
glue,
+ lifecycle,
posterior,
reshape2,
rlang (>= 0.3.0),
diff --git a/NAMESPACE b/NAMESPACE
index b8cf818b..56bfb045 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -226,3 +226,6 @@ importFrom(dplyr,top_n)
importFrom(dplyr,ungroup)
importFrom(dplyr,vars)
importFrom(ggplot2,"%+replace%")
+importFrom(lifecycle,deprecate_warn)
+importFrom(lifecycle,deprecated)
+importFrom(lifecycle,is_present)
diff --git a/NEWS.md b/NEWS.md
index b3e8922c..24ef6902 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,5 +1,14 @@
# bayesplot (development version)
+* Deprecate user-facing `size` arguments that controlled line width in favor of
+ `linewidth` across all plotting functions. The `size` argument still works but
+ emits a deprecation warning. (#408)
+* 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`, matching ggplot2 4.0
+ semantics. The default `size` has been changed from 1 to 2.5 to preserve the
+ previous visual appearance (old `size * fatten`). (#408)
+* Added `lifecycle` as an imported dependency for deprecation infrastructure.
* Documentation added for all exported `*_data()` functions (#209)
* Improved documentation for `binwidth`, `bins`, and `breaks` arguments to clarify they are passed to `ggplot2::geom_area()` and `ggdist::stat_dots()` in addition to `ggplot2::geom_histogram()`
* Improved documentation for `freq` argument to clarify it applies to frequency polygons in addition to histograms
diff --git a/R/bayesplot-package.R b/R/bayesplot-package.R
index 2727a62a..eb26da38 100644
--- a/R/bayesplot-package.R
+++ b/R/bayesplot-package.R
@@ -4,6 +4,7 @@
#' @aliases bayesplot
#'
#' @import ggplot2 stats rlang
+#' @importFrom lifecycle deprecated deprecate_warn is_present
#' @importFrom dplyr %>% summarise group_by select
#'
#' @description
diff --git a/R/helpers-shared.R b/R/helpers-shared.R
index 34890feb..6a9425a3 100644
--- a/R/helpers-shared.R
+++ b/R/helpers-shared.R
@@ -45,6 +45,52 @@ 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) {
+ if (!is.null(size)) {
+ lifecycle::deprecate_warn(
+ when = "1.16.0",
+ what = paste0(calling_fn %||% "fn", "(size)"),
+ with = paste0(calling_fn %||% "fn", "(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 2727928f..c239f84a 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)
@@ -561,7 +564,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 6891ed46..4ef6e520 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 e41cbae9..a77df7a2 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 2c3f54a9..96c95d03 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
-#' [ggplot2::geom_line()] and [ggplot2::geom_pointrange()].
+#' @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_point()]
+#' 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)`,
@@ -147,7 +149,6 @@
#' group = esoph$agegp,
#' freq=FALSE,
#' prob = 0.5,
-#' fatten = 1,
#' size = 1.5
#' )
#' }
@@ -162,8 +163,8 @@ ppc_bars <-
...,
prob = 0.9,
width = 0.9,
- size = 1,
- fatten = 2.5,
+ size = 2.5,
+ fatten = deprecated(),
linewidth = 1,
freq = TRUE) {
@@ -172,6 +173,8 @@ ppc_bars <-
check_ignored_arguments(...)
dots$group <- NULL
}
+ size <- resolve_fatten(fatten, size, default_size = 2.5,
+ calling_fn = "ppc_bars")
data <- ppc_bars_data(
y = y,
@@ -197,7 +200,6 @@ ppc_bars <-
geom_pointrange(
mapping = intervals_inner_aes(needs_y = TRUE, color = "yrep"),
size = size,
- fatten = fatten,
linewidth = linewidth,
na.rm = TRUE
) +
@@ -229,8 +231,8 @@ ppc_bars_grouped <-
facet_args = list(),
prob = 0.9,
width = 0.9,
- size = 1,
- fatten = 2.5,
+ size = 2.5,
+ fatten = deprecated(),
linewidth = 1,
freq = TRUE) {
check_ignored_arguments(...)
@@ -277,6 +279,7 @@ ppc_rootogram <- function(y,
...,
prob = 0.9,
size = 1,
+ linewidth = 1,
bound_distinct = TRUE) {
check_ignored_arguments(...)
style <- match.arg(style)
@@ -289,7 +292,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),
@@ -313,16 +315,15 @@ ppc_rootogram <- function(y,
geom_pointrange(
aes(y = .data$pred_median, ymin = .data$lower, ymax = .data$upper, color = "y_rep"),
fill = get_color("lh"),
- linewidth = size,
+ linewidth = linewidth,
size = size,
- fatten = 2,
alpha = 1
)
} else {
geom_smooth(
aes(x = .data$xpos, y = .data$tyexp, color = "Expected"),
fill = get_color("d"),
- linewidth = size,
+ linewidth = linewidth,
stat = "identity"
)
}
diff --git a/R/ppc-distributions.R b/R/ppc-distributions.R
index d32a2e1a..264c7c08 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
@@ -111,7 +113,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()
#'
@@ -134,7 +136,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
@@ -168,7 +170,8 @@ ppc_dens_overlay <-
function(y,
yrep,
...,
- size = 0.25,
+ size = NULL,
+ linewidth = 0.25,
alpha = 0.7,
trim = FALSE,
bw = "nrd0",
@@ -177,6 +180,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)
@@ -184,7 +188,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,
@@ -222,7 +226,8 @@ ppc_dens_overlay_grouped <- function(y,
yrep,
group,
...,
- size = 0.25,
+ size = NULL,
+ linewidth = 0.25,
alpha = 0.7,
trim = FALSE,
bw = "nrd0",
@@ -231,12 +236,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,
@@ -269,9 +275,11 @@ ppc_ecdf_overlay <- function(y,
...,
discrete = FALSE,
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")
data <- ppc_data(y, yrep)
ggplot(data) +
@@ -292,7 +300,7 @@ ppc_ecdf_overlay <- function(y,
data = function(x) dplyr::filter(x, !.data$is_y),
mapping = aes(group = .data$rep_id, color = "yrep"),
geom = if (discrete) "step" else "line",
- linewidth = size,
+ linewidth = linewidth,
alpha = alpha,
pad = pad
) +
@@ -318,9 +326,11 @@ ppc_ecdf_overlay_grouped <- function(y,
...,
discrete = FALSE,
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")
p_overlay <- ppc_ecdf_overlay(
y = y,
@@ -328,7 +338,7 @@ ppc_ecdf_overlay_grouped <- function(y,
...,
discrete = discrete,
pad = pad,
- size = size,
+ linewidth = linewidth,
alpha = alpha
)
@@ -349,10 +359,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(
@@ -361,7 +373,7 @@ ppc_dens <-
color = .data$is_y_label
)) +
geom_density(
- linewidth = size,
+ linewidth = linewidth,
alpha = alpha,
trim = trim,
bounds = bounds
@@ -431,13 +443,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(
@@ -449,7 +463,7 @@ ppc_freqpoly <-
stat = "bin",
binwidth = binwidth,
bins = bins,
- linewidth = size,
+ linewidth = linewidth,
alpha = alpha
) +
scale_fill_ppc() +
@@ -477,7 +491,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)
@@ -505,9 +520,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(
@@ -518,7 +535,7 @@ ppc_boxplot <-
)) +
geom_boxplot(
notch = notch,
- linewidth = size,
+ linewidth = linewidth,
alpha = alpha,
outlier.alpha = 2 / 3,
outlier.size = 1
@@ -591,13 +608,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")
@@ -608,7 +627,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..5d7ef77b 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")
@@ -135,8 +136,8 @@ ppc_intervals <-
prob = 0.5,
prob_outer = 0.9,
alpha = 0.33,
- size = 1,
- fatten = 2.5,
+ size = 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 = 2.5,
+ 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(
@@ -202,8 +204,8 @@ ppc_intervals_grouped <-
prob = 0.5,
prob_outer = 0.9,
alpha = 0.33,
- size = 1,
- fatten = 2.5,
+ size = 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 e0f93039..f3f8d2a7 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(
@@ -222,7 +227,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(
@@ -246,7 +251,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,
@@ -542,11 +547,13 @@ ppc_loo_intervals <-
prob = 0.5,
prob_outer = 0.9,
alpha = 0.33,
- size = 1,
- fatten = 2.5,
+ size = 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 = 2.5,
+ calling_fn = "ppc_loo_intervals")
y <- validate_y(y)
order_by_median <- match.arg(order) == "median"
if (!is.null(intervals)) {
@@ -598,14 +605,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(
@@ -637,8 +643,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))
@@ -688,7 +698,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 70c4e5a6..da6f0752 100644
--- a/R/ppd-distributions.R
+++ b/R/ppd-distributions.R
@@ -39,7 +39,8 @@ ppd_data <- function(ypred, group = NULL) {
ppd_dens_overlay <-
function(ypred,
...,
- size = 0.25,
+ size = NULL,
+ linewidth = 0.25,
alpha = 0.7,
trim = FALSE,
bw = "nrd0",
@@ -48,13 +49,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)
ggplot(data, mapping = aes(x = .data$value)) +
overlay_ppd_densities(
mapping = aes(group = .data$rep_id, color = "ypred"),
- linewidth = size,
+ linewidth = linewidth,
alpha = alpha,
trim = trim,
bw = bw,
@@ -66,7 +69,7 @@ ppd_dens_overlay <-
scale_color_ppd(
values = get_color("m"),
guide = guide_legend( # in case user turns legend back on
- override.aes = list(size = 2 * size, alpha = 1))
+ override.aes = list(linewidth = 2 * linewidth, alpha = 1))
) +
bayesplot_theme_get() +
dont_expand_axes() +
@@ -85,9 +88,12 @@ ppd_ecdf_overlay <-
...,
discrete = FALSE,
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")
data <- ppd_data(ypred)
ggplot(data, mapping = aes(x = .data$value)) +
@@ -100,14 +106,14 @@ ppd_ecdf_overlay <-
stat_ecdf(
mapping = aes(group = .data$rep_id, color = "ypred"),
geom = if (discrete) "step" else "line",
- linewidth = size,
+ linewidth = linewidth,
alpha = alpha,
pad = pad
) +
scale_color_ppd(
values = get_color("m"),
guide = guide_legend( # in case user turns legend back on
- override.aes = list(linewidth = 2 * size, alpha = 1))
+ override.aes = list(linewidth = 2 * linewidth, alpha = 1))
) +
scale_y_continuous(breaks = c(0, 0.5, 1)) +
bayesplot_theme_get() +
@@ -123,10 +129,13 @@ ppd_dens <-
function(ypred,
...,
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)
@@ -136,7 +145,7 @@ ppd_dens <-
fill = "ypred"
)) +
geom_density(
- linewidth = size,
+ linewidth = linewidth,
alpha = alpha,
trim = trim,
bounds = bounds
@@ -239,7 +248,8 @@ ppd_freqpoly <-
binwidth = NULL,
bins = NULL,
freq = TRUE,
- size = 0.5,
+ size = NULL,
+ linewidth = 0.5,
alpha = 1) {
dots <- list(...)
@@ -247,6 +257,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)
ggplot(data, mapping = set_hist_aes(
@@ -258,7 +270,7 @@ ppd_freqpoly <-
stat = "bin",
binwidth = binwidth,
bins = bins,
- linewidth = size,
+ linewidth = linewidth,
alpha = alpha
) +
facet_wrap_parsed("rep_label") +
@@ -285,10 +297,13 @@ ppd_freqpoly_grouped <-
binwidth = NULL,
bins = NULL,
freq = 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_freqpoly_grouped")
call <- match.call(expand.dots = FALSE)
g <- eval(ungroup_call("ppd_freqpoly", call), parent.frame())
g +
@@ -309,9 +324,12 @@ ppd_boxplot <-
function(ypred,
...,
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)
ggplot(data, mapping = aes(
@@ -322,7 +340,7 @@ ppd_boxplot <-
)) +
geom_boxplot(
notch = notch,
- linewidth = size,
+ linewidth = linewidth,
alpha = alpha,
outlier.color = get_color("lh"),
outlier.alpha = 2/3,
diff --git a/R/ppd-intervals.R b/R/ppd-intervals.R
index 63184072..76f05054 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
@@ -58,8 +57,8 @@ ppd_intervals <-
prob = 0.5,
prob_outer = 0.9,
alpha = 0.33,
- size = 1,
- fatten = 2.5,
+ size = 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 = 2.5,
+ 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() +
@@ -112,8 +111,8 @@ ppd_intervals_grouped <-
prob = 0.5,
prob_outer = 0.9,
alpha = 0.33,
- size = 1,
- fatten = 2.5,
+ size = 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 35e589dc..3dd085f7 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 ddf011b4..c479355a 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
)
}
@@ -58,8 +60,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 9da2fa17..be00d9b2 100644
--- a/man/PPC-discrete.Rd
+++ b/man/PPC-discrete.Rd
@@ -14,8 +14,8 @@ ppc_bars(
...,
prob = 0.9,
width = 0.9,
- size = 1,
- fatten = 2.5,
+ size = 2.5,
+ fatten = deprecated(),
linewidth = 1,
freq = TRUE
)
@@ -28,8 +28,8 @@ ppc_bars_grouped(
facet_args = list(),
prob = 0.9,
width = 0.9,
- size = 1,
- fatten = 2.5,
+ size = 2.5,
+ fatten = deprecated(),
linewidth = 1,
freq = TRUE
)
@@ -41,6 +41,7 @@ ppc_rootogram(
...,
prob = 0.9,
size = 1,
+ linewidth = 1,
bound_distinct = TRUE
)
@@ -67,10 +68,13 @@ 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
-\code{\link[ggplot2:geom_path]{ggplot2::geom_line()}} and \code{\link[ggplot2:geom_linerange]{ggplot2::geom_pointrange()}}.}
+\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_point]{ggplot2::geom_point()}}
+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.}
@@ -232,7 +236,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 b0099f2d..8fd7c787 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 = FALSE,
pad = TRUE,
- size = 0.25,
+ size = NULL,
+ linewidth = 0.25,
alpha = 0.7
)
@@ -66,11 +69,21 @@ ppc_ecdf_overlay_grouped(
...,
discrete = FALSE,
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,
@@ -164,8 +188,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()}}.}
@@ -349,7 +376,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()
@@ -372,7 +399,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 e23b29e9..b2f54d14 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
)
@@ -130,6 +131,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 6ad715e0..df14c253 100644
--- a/man/PPC-intervals.Rd
+++ b/man/PPC-intervals.Rd
@@ -18,8 +18,8 @@ ppc_intervals(
prob = 0.5,
prob_outer = 0.9,
alpha = 0.33,
- size = 1,
- fatten = 2.5,
+ size = 2.5,
+ fatten = deprecated(),
linewidth = 1
)
@@ -33,8 +33,8 @@ ppc_intervals_grouped(
prob = 0.5,
prob_outer = 0.9,
alpha = 0.33,
- size = 1,
- fatten = 2.5,
+ size = 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")
)
@@ -106,13 +108,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.
@@ -180,11 +184,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 7e9ebe02..8619b469 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,
@@ -89,8 +90,8 @@ ppc_loo_intervals(
prob = 0.5,
prob_outer = 0.9,
alpha = 0.33,
- size = 1,
- fatten = 2.5,
+ size = 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{
@@ -142,13 +144,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
@@ -217,6 +219,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 a53c62e4..432f680d 100644
--- a/man/PPD-distributions.Rd
+++ b/man/PPD-distributions.Rd
@@ -18,7 +18,8 @@ ppd_data(ypred, group = NULL)
ppd_dens_overlay(
ypred,
...,
- size = 0.25,
+ size = NULL,
+ linewidth = 0.25,
alpha = 0.7,
trim = FALSE,
bw = "nrd0",
@@ -33,11 +34,20 @@ ppd_ecdf_overlay(
...,
discrete = FALSE,
pad = TRUE,
- size = 0.25,
+ size = NULL,
+ linewidth = 0.25,
alpha = 0.7
)
-ppd_dens(ypred, ..., trim = FALSE, size = 0.5, alpha = 1, bounds = NULL)
+ppd_dens(
+ ypred,
+ ...,
+ trim = FALSE,
+ size = NULL,
+ linewidth = 0.5,
+ alpha = 1,
+ bounds = NULL
+)
ppd_hist(ypred, ..., binwidth = NULL, bins = NULL, breaks = NULL, freq = TRUE)
@@ -49,7 +59,8 @@ ppd_freqpoly(
binwidth = NULL,
bins = NULL,
freq = TRUE,
- size = 0.5,
+ size = NULL,
+ linewidth = 0.5,
alpha = 1
)
@@ -60,11 +71,12 @@ ppd_freqpoly_grouped(
binwidth = NULL,
bins = NULL,
freq = TRUE,
- size = 0.5,
+ size = NULL,
+ linewidth = 0.5,
alpha = 1
)
-ppd_boxplot(ypred, ..., notch = TRUE, size = 0.5, alpha = 1)
+ppd_boxplot(ypred, ..., notch = TRUE, size = NULL, linewidth = 0.5, alpha = 1)
}
\arguments{
\item{ypred}{An \code{S} by \code{N} matrix of draws from the posterior (or prior)
@@ -79,8 +91,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 9548709f..66b2f3b5 100644
--- a/man/PPD-intervals.Rd
+++ b/man/PPD-intervals.Rd
@@ -17,8 +17,8 @@ ppd_intervals(
prob = 0.5,
prob_outer = 0.9,
alpha = 0.33,
- size = 1,
- fatten = 2.5,
+ size = 2.5,
+ fatten = deprecated(),
linewidth = 1
)
@@ -31,8 +31,8 @@ ppd_intervals_grouped(
prob = 0.5,
prob_outer = 0.9,
alpha = 0.33,
- size = 1,
- fatten = 2.5,
+ size = 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(
@@ -93,13 +95,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.
@@ -132,12 +136,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
@@ -145,16 +149,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-size-alpha.svg
deleted file mode 100644
index 47b9fa1a..00000000
--- a/tests/testthat/_snaps/ppc-censoring/ppc-km-overlay-grouped-size-alpha.svg
+++ /dev/null
@@ -1,133 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/ppc-censoring/ppc-km-overlay-size-alpha.svg b/tests/testthat/_snaps/ppc-censoring/ppc-km-overlay-size-alpha.svg
deleted file mode 100644
index e2b51820..00000000
--- a/tests/testthat/_snaps/ppc-censoring/ppc-km-overlay-size-alpha.svg
+++ /dev/null
@@ -1,73 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/ppc-discrete/ppc-bars-default.svg b/tests/testthat/_snaps/ppc-discrete/ppc-bars-default.svg
deleted file mode 100644
index eebaca55..00000000
--- a/tests/testthat/_snaps/ppc-discrete/ppc-bars-default.svg
+++ /dev/null
@@ -1,83 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/ppc-discrete/ppc-bars-grouped-default.svg b/tests/testthat/_snaps/ppc-discrete/ppc-bars-grouped-default.svg
deleted file mode 100644
index f315b86b..00000000
--- a/tests/testthat/_snaps/ppc-discrete/ppc-bars-grouped-default.svg
+++ /dev/null
@@ -1,147 +0,0 @@
-
-
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
deleted file mode 100644
index ada88498..00000000
--- a/tests/testthat/_snaps/ppc-discrete/ppc-bars-grouped-facet-args-prob-size.svg
+++ /dev/null
@@ -1,145 +0,0 @@
-
-
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-fatten.svg
deleted file mode 100644
index fd35e987..00000000
--- a/tests/testthat/_snaps/ppc-discrete/ppc-bars-prob-0-33-width-size-fatten.svg
+++ /dev/null
@@ -1,85 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/ppc-discrete/ppc-bars-width-size-fatten.svg b/tests/testthat/_snaps/ppc-discrete/ppc-bars-width-size-fatten.svg
deleted file mode 100644
index c473580a..00000000
--- a/tests/testthat/_snaps/ppc-discrete/ppc-bars-width-size-fatten.svg
+++ /dev/null
@@ -1,83 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/ppc-discrete/ppc-rootogram-discrete-bound-distinct-false.svg b/tests/testthat/_snaps/ppc-discrete/ppc-rootogram-discrete-bound-distinct-false.svg
deleted file mode 100644
index 515ea491..00000000
--- a/tests/testthat/_snaps/ppc-discrete/ppc-rootogram-discrete-bound-distinct-false.svg
+++ /dev/null
@@ -1,83 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/ppc-discrete/ppc-rootogram-style-discrete-prob-size.svg b/tests/testthat/_snaps/ppc-discrete/ppc-rootogram-style-discrete-prob-size.svg
deleted file mode 100644
index 8df07504..00000000
--- a/tests/testthat/_snaps/ppc-discrete/ppc-rootogram-style-discrete-prob-size.svg
+++ /dev/null
@@ -1,97 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/ppc-discrete/ppc-rootogram-style-hanging-prob-size.svg b/tests/testthat/_snaps/ppc-discrete/ppc-rootogram-style-hanging-prob-size.svg
deleted file mode 100644
index c9cfa081..00000000
--- a/tests/testthat/_snaps/ppc-discrete/ppc-rootogram-style-hanging-prob-size.svg
+++ /dev/null
@@ -1,73 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/ppc-distributions/ppc-boxplot-alpha-size.svg b/tests/testthat/_snaps/ppc-distributions/ppc-boxplot-alpha-size.svg
deleted file mode 100644
index f9b70a1c..00000000
--- a/tests/testthat/_snaps/ppc-distributions/ppc-boxplot-alpha-size.svg
+++ /dev/null
@@ -1,105 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/ppc-distributions/ppc-dens-overlay-alpha-size.svg b/tests/testthat/_snaps/ppc-distributions/ppc-dens-overlay-alpha-size.svg
deleted file mode 100644
index 2f87f1d6..00000000
--- a/tests/testthat/_snaps/ppc-distributions/ppc-dens-overlay-alpha-size.svg
+++ /dev/null
@@ -1,73 +0,0 @@
-
-
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-size.svg
deleted file mode 100644
index 5a55e575..00000000
--- a/tests/testthat/_snaps/ppc-distributions/ppc-dens-overlay-grouped-alpha-size.svg
+++ /dev/null
@@ -1,234 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/ppc-distributions/ppc-ecdf-overlay-discrete-size-alpha.svg b/tests/testthat/_snaps/ppc-distributions/ppc-ecdf-overlay-discrete-size-alpha.svg
deleted file mode 100644
index e35e25a8..00000000
--- a/tests/testthat/_snaps/ppc-distributions/ppc-ecdf-overlay-discrete-size-alpha.svg
+++ /dev/null
@@ -1,73 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/ppc-distributions/ppc-ecdf-overlay-grouped-discrete-size-alpha.svg b/tests/testthat/_snaps/ppc-distributions/ppc-ecdf-overlay-grouped-discrete-size-alpha.svg
deleted file mode 100644
index cb9301ac..00000000
--- a/tests/testthat/_snaps/ppc-distributions/ppc-ecdf-overlay-grouped-discrete-size-alpha.svg
+++ /dev/null
@@ -1,133 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-alpha-binwidth-size.svg b/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-alpha-binwidth-size.svg
deleted file mode 100644
index 5fb2acd0..00000000
--- a/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-alpha-binwidth-size.svg
+++ /dev/null
@@ -1,185 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/ppc-distributions/ppd-boxplot-alpha-size.svg b/tests/testthat/_snaps/ppc-distributions/ppd-boxplot-alpha-size.svg
deleted file mode 100644
index a73bf088..00000000
--- a/tests/testthat/_snaps/ppc-distributions/ppd-boxplot-alpha-size.svg
+++ /dev/null
@@ -1,84 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/ppc-distributions/ppd-dens-overlay-alpha-size.svg b/tests/testthat/_snaps/ppc-distributions/ppd-dens-overlay-alpha-size.svg
deleted file mode 100644
index b7098aea..00000000
--- a/tests/testthat/_snaps/ppc-distributions/ppd-dens-overlay-alpha-size.svg
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/ppc-distributions/ppd-freqpoly-alpha-binwidth-size.svg b/tests/testthat/_snaps/ppc-distributions/ppd-freqpoly-alpha-binwidth-size.svg
deleted file mode 100644
index 53968e83..00000000
--- a/tests/testthat/_snaps/ppc-distributions/ppd-freqpoly-alpha-binwidth-size.svg
+++ /dev/null
@@ -1,163 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/ppc-intervals/ppc-intervals-default.svg b/tests/testthat/_snaps/ppc-intervals/ppc-intervals-default.svg
deleted file mode 100644
index 4ed73687..00000000
--- a/tests/testthat/_snaps/ppc-intervals/ppc-intervals-default.svg
+++ /dev/null
@@ -1,466 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/ppc-intervals/ppc-intervals-grouped-default.svg b/tests/testthat/_snaps/ppc-intervals/ppc-intervals-grouped-default.svg
deleted file mode 100644
index 50546836..00000000
--- a/tests/testthat/_snaps/ppc-intervals/ppc-intervals-grouped-default.svg
+++ /dev/null
@@ -1,615 +0,0 @@
-
-
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
deleted file mode 100644
index f5997757..00000000
--- a/tests/testthat/_snaps/ppc-intervals/ppc-intervals-grouped-x-values.svg
+++ /dev/null
@@ -1,607 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/ppc-intervals/ppc-intervals-interval-width.svg b/tests/testthat/_snaps/ppc-intervals/ppc-intervals-interval-width.svg
deleted file mode 100644
index ffac8c6f..00000000
--- a/tests/testthat/_snaps/ppc-intervals/ppc-intervals-interval-width.svg
+++ /dev/null
@@ -1,466 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/ppc-intervals/ppc-intervals-x-values.svg b/tests/testthat/_snaps/ppc-intervals/ppc-intervals-x-values.svg
deleted file mode 100644
index 7103c230..00000000
--- a/tests/testthat/_snaps/ppc-intervals/ppc-intervals-x-values.svg
+++ /dev/null
@@ -1,468 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/ppc-intervals/ppd-intervals-default.svg b/tests/testthat/_snaps/ppc-intervals/ppd-intervals-default.svg
deleted file mode 100644
index f401a74b..00000000
--- a/tests/testthat/_snaps/ppc-intervals/ppd-intervals-default.svg
+++ /dev/null
@@ -1,355 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/ppc-intervals/ppd-intervals-grouped-default.svg b/tests/testthat/_snaps/ppc-intervals/ppd-intervals-grouped-default.svg
deleted file mode 100644
index 4a443550..00000000
--- a/tests/testthat/_snaps/ppc-intervals/ppd-intervals-grouped-default.svg
+++ /dev/null
@@ -1,504 +0,0 @@
-
-
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
deleted file mode 100644
index bcbbdfb8..00000000
--- a/tests/testthat/_snaps/ppc-intervals/ppd-intervals-grouped-x-values.svg
+++ /dev/null
@@ -1,496 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/ppc-intervals/ppd-intervals-interval-width.svg b/tests/testthat/_snaps/ppc-intervals/ppd-intervals-interval-width.svg
deleted file mode 100644
index 16b407d8..00000000
--- a/tests/testthat/_snaps/ppc-intervals/ppd-intervals-interval-width.svg
+++ /dev/null
@@ -1,355 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/ppc-intervals/ppd-intervals-x-values.svg b/tests/testthat/_snaps/ppc-intervals/ppd-intervals-x-values.svg
deleted file mode 100644
index 6b97f063..00000000
--- a/tests/testthat/_snaps/ppc-intervals/ppd-intervals-x-values.svg
+++ /dev/null
@@ -1,357 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/ppc-loo/ppc-loo-intervals-default.svg b/tests/testthat/_snaps/ppc-loo/ppc-loo-intervals-default.svg
deleted file mode 100644
index 7581eea8..00000000
--- a/tests/testthat/_snaps/ppc-loo/ppc-loo-intervals-default.svg
+++ /dev/null
@@ -1,460 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/ppc-loo/ppc-loo-intervals-order.svg b/tests/testthat/_snaps/ppc-loo/ppc-loo-intervals-order.svg
deleted file mode 100644
index 917cab2c..00000000
--- a/tests/testthat/_snaps/ppc-loo/ppc-loo-intervals-order.svg
+++ /dev/null
@@ -1,450 +0,0 @@
-
-
diff --git a/tests/testthat/_snaps/ppc-loo/ppc-loo-intervals-prob.svg b/tests/testthat/_snaps/ppc-loo/ppc-loo-intervals-prob.svg
deleted file mode 100644
index d847f56f..00000000
--- a/tests/testthat/_snaps/ppc-loo/ppc-loo-intervals-prob.svg
+++ /dev/null
@@ -1,460 +0,0 @@
-
-
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 005fdc94..5cd731e7 100644
--- a/tests/testthat/test-ppc-discrete.R
+++ b/tests/testthat/test-ppc-discrete.R
@@ -112,12 +112,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(
@@ -125,12 +124,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 93b52e0a..1a53edae 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))
})
@@ -58,7 +58,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]))
@@ -79,7 +79,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]))
@@ -164,10 +164,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
@@ -177,10 +177,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)
})
@@ -208,8 +208,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, ])
@@ -218,8 +218,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", {
@@ -270,12 +270,12 @@ test_that("ppc_ecdf_overlay renders correctly", {
vdiff_y2,
vdiff_yrep2,
discrete = TRUE,
- size = 2,
+ linewidth = 2,
alpha = .2
)
vdiffr::expect_doppelganger(
- "ppc_ecdf_overlay (discrete, size, alpha)",
+ "ppc_ecdf_overlay (discrete, linewidth, alpha)",
p_custom
)
})
@@ -293,12 +293,12 @@ test_that("ppc_ecdf_overlay_grouped renders correctly", {
vdiff_yrep2,
vdiff_group2,
discrete = TRUE,
- size = 2,
+ linewidth = 2,
alpha = .2
)
vdiffr::expect_doppelganger(
- "ppc_ecdf_overlay_grouped (discrete, size, alpha)",
+ "ppc_ecdf_overlay_grouped (discrete, linewidth, alpha)",
p_custom
)
})
@@ -324,8 +324,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))
@@ -334,8 +334,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))
@@ -353,12 +353,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 a1499303..acfc139a 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