From f8baf90fe8bca2494d1ceb041448864587f2b0ed Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sun, 1 Dec 2024 16:49:19 +0100 Subject: [PATCH] Harmonize API (#373) --- R/plot.bayesfactor_parameters.R | 12 ++-- R/plot.binned_residuals.R | 8 +-- R/plot.check_collinearity.R | 8 +-- R/plot.check_heteroscedasticity.R | 4 +- R/plot.check_homogeneity.R | 8 +-- R/plot.check_model.R | 48 +++++++------- R/plot.check_normality.R | 64 +++++++++---------- R/plot.check_outliers.R | 8 +-- R/plot.check_outliers_new.R | 14 ++-- R/plot.check_overdisp.R | 10 +-- R/plot.check_predictions.R | 52 +++++++-------- R/plot.compare_performance.R | 4 +- R/plot.describe_distribution.R | 56 ++++++++-------- R/plot.dw_data_tabulate.R | 12 ++-- R/plot.equivalence_test.R | 42 ++++++------ R/plot.estimate_density.R | 24 +++---- R/plot.p_direction.R | 4 +- R/plot.p_function.R | 20 +++--- R/plot.p_significance.R | 4 +- R/plot.parameters_brms_meta.R | 16 ++--- R/plot.parameters_pca.R | 6 +- R/plot.parameters_simulate.R | 8 +-- R/plot.performance_simres.R | 10 +-- R/plot.point_estimates.R | 22 +++---- R/plot.rope.R | 8 +-- R/plot.si.R | 12 ++-- R/utils_add_prior_layer.R | 16 ++--- man/plot.datawizard_table.Rd | 6 +- man/plot.see_bayesfactor_parameters.Rd | 8 +-- man/plot.see_check_collinearity.Rd | 4 +- man/plot.see_check_heteroscedasticity.Rd | 4 +- man/plot.see_check_normality.Rd | 8 +-- man/plot.see_check_outliers.Rd | 8 +-- man/plot.see_compare_performance.Rd | 4 +- man/plot.see_equivalence_test.Rd | 12 ++-- man/plot.see_estimate_density.Rd | 12 ++-- man/plot.see_p_direction.Rd | 4 +- man/plot.see_p_function.Rd | 8 +-- man/plot.see_p_significance.Rd | 4 +- man/plot.see_parameters_brms_meta.Rd | 16 ++--- man/plot.see_parameters_distribution.Rd | 12 ++-- man/plot.see_parameters_pca.Rd | 4 +- man/plot.see_parameters_simulate.Rd | 8 +-- man/plot.see_performance_simres.Rd | 8 +-- man/plot.see_point_estimate.Rd | 4 +- man/plot.see_rope.Rd | 8 +-- man/plot.see_si.Rd | 8 +-- man/print.see_performance_pp_check.Rd | 12 ++-- tests/testthat/test-plot.check_dag.R | 1 - tests/testthat/test-plot.compare_parameters.R | 2 +- .../test-plot.describe_distribution.R | 2 +- tests/testthat/test-plot.p_direction.R | 7 +- tests/testthat/test-plot.p_significance.R | 8 ++- tests/testthat/test-plot.parameters_model.R | 5 +- .../testthat/test-plot.simulate_parameters.R | 2 +- 55 files changed, 346 insertions(+), 343 deletions(-) diff --git a/R/plot.bayesfactor_parameters.R b/R/plot.bayesfactor_parameters.R index 7809c9b43..26fad6f0f 100644 --- a/R/plot.bayesfactor_parameters.R +++ b/R/plot.bayesfactor_parameters.R @@ -3,8 +3,8 @@ #' The `plot()` method for the `bayestestR::bayesfactor_parameters()` function. #' #' @param size_point Numeric specifying size of point-geoms. -#' @param rope_alpha Numeric specifying transparency level of ROPE ribbon. -#' @param rope_color Character specifying color of ROPE ribbon. +#' @param alpha_rope Numeric specifying transparency level of ROPE ribbon. +#' @param color_rope Character specifying color of ROPE ribbon. #' @param show_intercept Logical, if `TRUE`, the intercept-parameter is included #' in the plot. By default, it is hidden because in many cases the #' intercept-parameter has a posterior distribution on a very different @@ -19,8 +19,8 @@ #' @export plot.see_bayesfactor_parameters <- function(x, size_point = 2, - rope_color = "#0171D3", - rope_alpha = 0.2, + color_rope = "#0171D3", + alpha_rope = 0.2, show_intercept = FALSE, ...) { if ("log_BF" %in% names(x) && !"BF" %in% names(x)) { @@ -80,8 +80,8 @@ plot.see_bayesfactor_parameters <- function(x, xmax = rope[2], ymin = 0, ymax = Inf, - fill = rope_color, - alpha = rope_alpha + fill = color_rope, + alpha = alpha_rope ) } else { p <- p + diff --git a/R/plot.binned_residuals.R b/R/plot.binned_residuals.R index fe357f6ae..8e4849887 100644 --- a/R/plot.binned_residuals.R +++ b/R/plot.binned_residuals.R @@ -1,6 +1,6 @@ #' @export plot.see_binned_residuals <- function(x, - size_line = 0.7, + linewidth = 0.7, size_point = 2.2, size_title = 12, size_axis_title = base_size, @@ -62,7 +62,7 @@ plot.see_binned_residuals <- function(x, se = FALSE, formula = y ~ s(x, bs = "tp"), colour = colors[3], - linewidth = size_line + linewidth = linewidth ) } @@ -89,7 +89,7 @@ plot.see_binned_residuals <- function(x, ggplot2::geom_point(ggplot2::aes(y = .data$ybar), size = size_point) + ggplot2::geom_errorbar( ggplot2::aes(ymin = .data$CI_low, ymax = .data$CI_high), - linewidth = size_line, + linewidth = linewidth, width = 0 ) } else { @@ -101,7 +101,7 @@ plot.see_binned_residuals <- function(x, ymax = .data$CI_high, colour = .data$group ), - linewidth = size_line, + linewidth = linewidth, width = 0 ) } diff --git a/R/plot.check_collinearity.R b/R/plot.check_collinearity.R index 62284d4a9..6d7bf587f 100644 --- a/R/plot.check_collinearity.R +++ b/R/plot.check_collinearity.R @@ -19,7 +19,7 @@ plot.see_check_collinearity <- function(x, data = NULL, colors = c("#3aaf85", "#1b6ca8", "#cd201f"), size_point = 3.5, - size_line = 0.8, + linewidth = 0.8, size_title = 12, size_axis_title = base_size, base_size = 10, @@ -53,7 +53,7 @@ plot.see_check_collinearity <- function(x, .plot_diag_vif( dat, size_point = size_point, - size_line = size_line, + linewidth = linewidth, size_title = size_title, size_axis_title = size_axis_title, base_size = base_size, @@ -66,7 +66,7 @@ plot.see_check_collinearity <- function(x, .plot_diag_vif <- function(x, size_point, - size_line, + linewidth, theme_style = theme_lucid, size_title = 12, size_axis_title = 10, @@ -132,7 +132,7 @@ plot.see_check_collinearity <- function(x, if (!is.null(ci_data)) { p <- p + ggplot2::geom_linerange( - linewidth = size_line, + linewidth = linewidth, na.rm = TRUE ) + ggplot2::geom_segment( diff --git a/R/plot.check_heteroscedasticity.R b/R/plot.check_heteroscedasticity.R index a81323c71..d1f05c54c 100644 --- a/R/plot.check_heteroscedasticity.R +++ b/R/plot.check_heteroscedasticity.R @@ -19,7 +19,7 @@ plot.see_check_heteroscedasticity <- function(x, data = NULL, size_point = 2, - size_line = 0.8, + linewidth = 0.8, size_title = 12, size_axis_title = base_size, base_size = 10, @@ -79,7 +79,7 @@ plot.see_check_heteroscedasticity <- function(x, .plot_diag_homogeneity( dat, size_point = size_point, - size_line = size_line, + linewidth = linewidth, base_size = base_size, size_title = size_title, size_axis_title = size_axis_title, diff --git a/R/plot.check_homogeneity.R b/R/plot.check_homogeneity.R index 209e6f1b8..ea7a4b2a1 100644 --- a/R/plot.check_homogeneity.R +++ b/R/plot.check_homogeneity.R @@ -133,14 +133,14 @@ plot.see_check_homogeneity <- function(x, data = NULL, ...) { .plot_diag_homogeneity <- function(x, size_point, - size_line, + linewidth, alpha_level = 0.2, theme_style = theme_lucid, size_title = 12, size_axis_title = 10, base_size = 10, colors = unname(social_colors(c("green", "blue", "red"))), - dot_alpha_level = 0.8, + alpha_dot = 0.8, show_dots = TRUE) { p <- ggplot2::ggplot(x, ggplot2::aes(x = .data$x, .data$y)) @@ -149,7 +149,7 @@ plot.see_check_homogeneity <- function(x, data = NULL, ...) { geom_point2( colour = colors[2], size = size_point, - alpha = dot_alpha_level + alpha = alpha_dot ) } @@ -159,7 +159,7 @@ plot.see_check_homogeneity <- function(x, data = NULL, ...) { se = TRUE, alpha = alpha_level, formula = y ~ x, - linewidth = size_line, + linewidth = linewidth, colour = colors[1] ) + ggplot2::labs( diff --git a/R/plot.check_model.R b/R/plot.check_model.R index 579d46f14..065a8f636 100644 --- a/R/plot.check_model.R +++ b/R/plot.check_model.R @@ -31,14 +31,14 @@ plot.see_check_model <- function(x, panel <- attr(x, "panel") check <- attr(x, "check") size_point <- attr(x, "dot_size") - size_line <- attr(x, "line_size") + linewidth <- attr(x, "line_size") show_labels <- attr(x, "show_labels") %||% TRUE size_text <- attr(x, "text_size") base_size <- attr(x, "base_size") size_axis_title <- attr(x, "axis_title_size") size_title <- attr(x, "title_size") alpha_level <- attr(x, "alpha") - dot_alpha_level <- attr(x, "dot_alpha") + alpha_dot <- attr(x, "alpha_dot") show_dots <- attr(x, "show_dots") detrend <- attr(x, "detrend") model_info <- attr(x, "model_info") @@ -73,8 +73,8 @@ plot.see_check_model <- function(x, alpha_level <- 0.2 } - if (is.null(dot_alpha_level)) { - dot_alpha_level <- 0.8 + if (is.null(alpha_dot)) { + alpha_dot <- 0.8 } if (is.null(base_size)) { @@ -101,7 +101,7 @@ plot.see_check_model <- function(x, p$PP_CHECK <- plot.see_performance_pp_check( x$PP_CHECK, style = style, - size_line = size_line, + linewidth = linewidth, size_point = size_point, base_size = base_size, size_axis_title = size_axis_title, @@ -117,14 +117,14 @@ plot.see_check_model <- function(x, p$NCV <- .plot_diag_linearity( x$NCV, size_point = size_point, - size_line = size_line, + linewidth = linewidth, alpha_level = alpha_level, theme_style = style, base_size = base_size, size_axis_title = size_axis_title, size_title = size_title, colors = colors, - dot_alpha_level = dot_alpha_level, + alpha_dot = alpha_dot, show_dots = show_dots ) } @@ -152,7 +152,7 @@ plot.see_check_model <- function(x, size_axis_title = size_axis_title, size_title = size_title, colors = colors[c(1, 2)], - size_line = size_line, + linewidth = linewidth, type = overdisp_type ) } @@ -161,14 +161,14 @@ plot.see_check_model <- function(x, p$HOMOGENEITY <- .plot_diag_homogeneity( x$HOMOGENEITY, size_point = size_point, - size_line = size_line, + linewidth = linewidth, alpha_level = alpha_level, theme_style = style, base_size = base_size, size_axis_title = size_axis_title, size_title = size_title, colors = colors, - dot_alpha_level = dot_alpha_level, + alpha_dot = alpha_dot, show_dots = show_dots ) } @@ -178,14 +178,14 @@ plot.see_check_model <- function(x, x$INFLUENTIAL, show_labels = show_labels, size_text = size_text, - size_line = size_line, + linewidth = linewidth, size_point = size_point, theme_style = style, size_axis_title = size_axis_title, size_title = size_title, base_size = base_size, colors = colors, - dot_alpha_level = dot_alpha_level, + alpha_dot = alpha_dot, show_dots = show_dots ) } @@ -194,7 +194,7 @@ plot.see_check_model <- function(x, p$VIF <- .plot_diag_vif( x$VIF, size_point = 1.5 * size_point, - size_line = size_line, + linewidth = linewidth, theme_style = style, base_size = base_size, size_axis_title = size_axis_title, @@ -209,10 +209,10 @@ plot.see_check_model <- function(x, if (inherits(x$QQ, "performance_simres")) { p$QQ <- plot( x$QQ, - size_line = size_line, + linewidth = linewidth, size_point = 0.9 * size_point, alpha = alpha_level, - dot_alpha = dot_alpha_level, + alpha_dot = alpha_dot, colors = colors, detrend = detrend, style = style, @@ -224,7 +224,7 @@ plot.see_check_model <- function(x, p$QQ <- .plot_diag_qq( x$QQ, size_point = size_point, - size_line = size_line, + linewidth = linewidth, size_axis_title = size_axis_title, size_title = size_title, alpha_level = alpha_level, @@ -232,7 +232,7 @@ plot.see_check_model <- function(x, theme_style = style, base_size = base_size, colors = colors, - dot_alpha_level = dot_alpha_level, + alpha_dot = alpha_dot, show_dots = TRUE, # qq-plots w/o dots makes no sense model_info = model_info, model_class = model_class @@ -243,7 +243,7 @@ plot.see_check_model <- function(x, if ("NORM" %in% names(x) && !is.null(x$NORM) && any(c("normality", "all") %in% check)) { p$NORM <- .plot_diag_norm( x$NORM, - size_line = size_line, + linewidth = linewidth, alpha_level = alpha_level, theme_style = style, base_size = base_size, @@ -257,14 +257,14 @@ plot.see_check_model <- function(x, ps <- .plot_diag_reqq( x$REQQ, size_point, - size_line, + linewidth, size_axis_title = size_axis_title, size_title = size_title, alpha_level = alpha_level, theme_style = style, base_size = base_size, colors = colors, - dot_alpha_level = dot_alpha_level, + alpha_dot = alpha_dot, show_dots = TRUE # qq-plots w/o dots makes no sense ) @@ -285,14 +285,14 @@ plot.see_check_model <- function(x, .plot_diag_linearity <- function(x, size_point, - size_line, + linewidth, size_axis_title = 10, size_title = 12, alpha_level = 0.2, theme_style = theme_lucid, base_size = 10, colors = unname(social_colors(c("green", "blue", "red"))), - dot_alpha_level = 0.8, + alpha_dot = 0.8, show_dots = TRUE) { p <- ggplot2::ggplot(x, ggplot2::aes(x = .data$x, y = .data$y)) @@ -301,7 +301,7 @@ plot.see_check_model <- function(x, geom_point2( colour = colors[2], size = size_point, - alpha = dot_alpha_level + alpha = alpha_dot ) } @@ -311,7 +311,7 @@ plot.see_check_model <- function(x, se = TRUE, formula = y ~ x, alpha = alpha_level, - linewidth = size_line, + linewidth = linewidth, colour = colors[1] ) + ggplot2::geom_hline(yintercept = 0, linetype = "dashed") + diff --git a/R/plot.check_normality.R b/R/plot.check_normality.R index 5c70aefb8..bfbee7aba 100644 --- a/R/plot.check_normality.R +++ b/R/plot.check_normality.R @@ -7,8 +7,8 @@ #' Options are `"qq"` (default) for quantile-quantile (Q-Q) plots, #' `"pp"` for probability-probability (P-P) plots, or #' `"density"` for density overlay plots. -#' @param size_line Numeric value specifying size of line geoms. -#' @param dot_alpha Numeric value specifying alpha level of the point geoms. +#' @param linewidth Numeric value specifying size of line geoms. +#' @param alpha_dot Numeric value specifying alpha level of the point geoms. #' @param alpha Numeric value specifying alpha level of the confidence bands. #' @param colors Character vector of length two, indicating the colors (in #' hex-format) for points and line. @@ -42,13 +42,13 @@ plot.see_check_normality <- function(x, type = c("qq", "pp", "density"), data = NULL, - size_line = 0.8, + linewidth = 0.8, size_point = 2, size_title = 12, size_axis_title = base_size, base_size = 10, alpha = 0.2, - dot_alpha = 0.8, + alpha_dot = 0.8, colors = c("#3aaf85", "#1b6ca8"), detrend = TRUE, method = "ell", @@ -71,7 +71,7 @@ plot.see_check_normality <- function(x, .plot_diag_reqq( attributes(x)$re_qq, size_point = size_point, - size_line = size_line, + linewidth = linewidth, alpha_level = alpha, size_axis_title = size_axis_title, size_title = size_title, @@ -93,10 +93,10 @@ plot.see_check_normality <- function(x, } else if (inherits(model, "performance_simres")) { return(plot.see_performance_simres( model, - size_line = size_line, + linewidth = linewidth, size_point = size_point, alpha = alpha, - dot_alpha = dot_alpha, + alpha_dot = alpha_dot, colors = colors, detrend = detrend, base_size = base_size, @@ -114,13 +114,13 @@ plot.see_check_normality <- function(x, .plot_diag_qq( dat, size_point = size_point, - size_line = size_line, + linewidth = linewidth, size_axis_title = size_axis_title, size_title = size_title, base_size = base_size, alpha_level = alpha, detrend = detrend, - dot_alpha_level = dot_alpha, + alpha_dot = alpha_dot, model_info = model_info, method = method, model_class = class(model)[1] @@ -142,7 +142,7 @@ plot.see_check_normality <- function(x, ) .plot_diag_norm( dat, - size_line = size_line, + linewidth = linewidth, alpha_level = alpha, base_size = base_size, size_axis_title = size_axis_title, @@ -154,13 +154,13 @@ plot.see_check_normality <- function(x, .plot_diag_pp( dat, size_point = size_point, - size_line = size_line, + linewidth = linewidth, base_size = base_size, size_axis_title = size_axis_title, size_title = size_title, alpha_level = alpha, detrend = detrend, - dot_alpha_level = dot_alpha, + alpha_dot = alpha_dot, method = method ) } @@ -171,7 +171,7 @@ plot.see_check_normality <- function(x, # normality plot: density ------------------------- .plot_diag_norm <- function(x, - size_line, + linewidth, size_axis_title = 10, size_title = 12, alpha_level = 0.2, @@ -189,7 +189,7 @@ plot.see_check_normality <- function(x, ggplot2::geom_line( mapping = ggplot2::aes(y = .data$curve), colour = colors[1], - linewidth = size_line, + linewidth = linewidth, na.rm = TRUE ) + ggplot2::labs( @@ -213,7 +213,7 @@ plot.see_check_normality <- function(x, .plot_diag_qq <- function(x, size_point, - size_line, + linewidth, size_axis_title = 10, size_title = 12, alpha_level = 0.2, @@ -222,7 +222,7 @@ plot.see_check_normality <- function(x, theme_style = theme_lucid, base_size = 10, colors = unname(social_colors(c("green", "blue", "red"))), - dot_alpha_level = 0.8, + alpha_dot = 0.8, show_dots = TRUE, model_info = NULL, model_class = NULL) { @@ -239,7 +239,7 @@ plot.see_check_normality <- function(x, ), ggplot2::geom_qq_line( ggplot2::aes(sample = .data$y), - linewidth = size_line, + linewidth = linewidth, colour = colors[1], distribution = qhalfnorm, na.rm = TRUE @@ -259,11 +259,11 @@ plot.see_check_normality <- function(x, stroke = 0, size = size_point, colour = colors[2], - alpha = dot_alpha_level, + alpha = alpha_dot, detrend = detrend ), qqplotr::stat_qq_line( - linewidth = size_line, + linewidth = linewidth, colour = colors[1], detrend = detrend ) @@ -287,13 +287,13 @@ plot.see_check_normality <- function(x, if (detrend) { ggplot2::geom_hline( yintercept = 0, - linewidth = size_line, + linewidth = linewidth, colour = colors[1], na.rm = TRUE ) } else { ggplot2::geom_qq_line( - linewidth = size_line, + linewidth = linewidth, colour = colors[1], na.rm = TRUE ) @@ -349,7 +349,7 @@ plot.see_check_normality <- function(x, .plot_diag_pp <- function(x, size_point, - size_line, + linewidth, size_axis_title = base_size, size_title = 12, alpha_level = 0.2, @@ -358,12 +358,12 @@ plot.see_check_normality <- function(x, theme_style = theme_lucid, base_size = 10, colors = unname(social_colors(c("green", "blue", "red"))), - dot_alpha_level = 0.8) { + alpha_dot = 0.8) { if (requireNamespace("qqplotr", quietly = TRUE)) { p_plot <- ggplot2::ggplot(x, ggplot2::aes(sample = .data$res)) + qqplotr::stat_pp_band(alpha = alpha_level, detrend = detrend, bandType = method) + qqplotr::stat_pp_line( - linewidth = size_line, + linewidth = linewidth, colour = colors[1], detrend = detrend ) + @@ -371,7 +371,7 @@ plot.see_check_normality <- function(x, shape = 16, stroke = 0, size = size_point, colour = colors[2], - alpha = dot_alpha_level, + alpha = alpha_dot, detrend = detrend ) } else if (requireNamespace("MASS", quietly = TRUE)) { @@ -384,14 +384,14 @@ plot.see_check_normality <- function(x, p_plot <- ggplot2::ggplot(x, ggplot2::aes(x = .data$probs, y = .data$y)) + ggplot2::geom_abline( slope = if (detrend) 0 else 1, - linewidth = size_line, + linewidth = linewidth, colour = colors[1] ) + geom_point2( mapping = if (detrend) ggplot2::aes(y = .data$y - .data$probs), colour = colors[2], size = size_point, - alpha = dot_alpha_level + alpha = alpha_dot ) } else { insight::format_error("Package 'qqplotr' OR 'MASS' required for P-P plots. Please install one of them.") @@ -422,7 +422,7 @@ plot.see_check_normality <- function(x, .plot_diag_reqq <- function(x, size_point, - size_line, + linewidth, size_axis_title = base_size, size_title = 12, panel = TRUE, @@ -430,7 +430,7 @@ plot.see_check_normality <- function(x, theme_style = theme_lucid, base_size = 10, colors = unname(social_colors(c("green", "blue", "red"))), - dot_alpha_level = 0.8, + alpha_dot = 0.8, show_dots = TRUE) { lapply(names(x), function(i) { dat <- x[[i]] @@ -444,7 +444,7 @@ plot.see_check_normality <- function(x, ggplot2::stat_smooth( method = "lm", alpha = alpha_level, - linewidth = size_line, + linewidth = linewidth, formula = y ~ x, colour = colors[1] ) + @@ -452,7 +452,7 @@ plot.see_check_normality <- function(x, ggplot2::aes(ymin = .data$conf.low, ymax = .data$conf.high), width = 0, colour = colors[2], - alpha = dot_alpha_level + alpha = alpha_dot ) + theme_style( base_size = base_size, @@ -467,7 +467,7 @@ plot.see_check_normality <- function(x, geom_point2( colour = colors[2], size = size_point, - alpha = dot_alpha_level + alpha = alpha_dot ) } diff --git a/R/plot.check_outliers.R b/R/plot.check_outliers.R index c81ce2375..8bd259578 100644 --- a/R/plot.check_outliers.R +++ b/R/plot.check_outliers.R @@ -32,11 +32,11 @@ #' @export plot.see_check_outliers <- function(x, size_text = 3.5, - size_line = 0.8, + linewidth = 0.8, size_title = 12, size_axis_title = base_size, base_size = 10, - dot_alpha = 0.8, + alpha_dot = 0.8, colors = c("#3aaf85", "#1b6ca8", "#cd201f"), rescale_distance = TRUE, type = c("dots", "bars"), @@ -51,11 +51,11 @@ plot.see_check_outliers <- function(x, influential_obs, show_labels = show_labels, size_text = size_text, - size_line = size_line, + linewidth = linewidth, size_axis_title = size_axis_title, size_title = size_title, base_size = base_size, - dot_alpha_level = dot_alpha, + alpha_dot = alpha_dot, colors = colors ) } else if (length(outlier_methods) == 1) { diff --git a/R/plot.check_outliers_new.R b/R/plot.check_outliers_new.R index 74d60527a..acbf5ea49 100644 --- a/R/plot.check_outliers_new.R +++ b/R/plot.check_outliers_new.R @@ -3,7 +3,7 @@ ref.color = "darkgray", ref.linetype = "dashed", show_labels = TRUE, - size_line = NULL, + linewidth = NULL, size_point = 2, size_text = NULL, size_axis_title = base_size, @@ -11,9 +11,9 @@ theme_style = theme_lucid, base_size = 10, colors = unname(social_colors(c("green", "blue grey", "red"))), - dot_alpha_level = 0.8, + alpha_dot = 0.8, show_dots = TRUE) { - size_line <- size_line %||% 0.7 + linewidth <- linewidth %||% 0.7 size_text <- size_text %||% 3 plot_data <- x @@ -30,7 +30,7 @@ p <- p + geom_point2( aes(colour = .data$Influential), na.rm = na.rm, - alpha = dot_alpha_level, + alpha = alpha_dot, size = size_point ) } @@ -52,7 +52,7 @@ na.rm = na.rm, se = FALSE, color = colors[1], - linewidth = size_line + linewidth = linewidth ) + scale_colour_manual(values = c(OK = colors[2], Influential = colors[3])) + (if (isTRUE(show_labels)) { @@ -97,7 +97,7 @@ y = .cook_ref[[.level]], color = colors[1], linetype = ref.linetype, - linewidth = size_line + linewidth = linewidth ) }), lapply(seq_along(cook.levels), function(.level) { @@ -107,7 +107,7 @@ y = -1 * .cook_ref[[.level]], color = colors[1], linetype = ref.linetype, - linewidth = size_line + linewidth = linewidth ) }), lapply(seq_along(cook.levels), function(.level) { diff --git a/R/plot.check_overdisp.R b/R/plot.check_overdisp.R index d57b71302..27c83b90e 100644 --- a/R/plot.check_overdisp.R +++ b/R/plot.check_overdisp.R @@ -1,6 +1,6 @@ #' @export plot.see_check_overdisp <- function(x, - size_line = 0.8, + linewidth = 0.8, size_title = 12, size_axis_title = base_size, base_size = 10, @@ -11,7 +11,7 @@ plot.see_check_overdisp <- function(x, x, style = theme_lucid, colors = colors, - size_line = size_line, + linewidth = linewidth, size_title = size_title, size_axis_title = size_axis_title, base_size = base_size, @@ -26,14 +26,14 @@ plot.see_check_overdisp <- function(x, size_title = 12, base_size = 10, colors = c("#3aaf85", "#1b6ca8"), - size_line = 0.8, + linewidth = 0.8, type = 1, ...) { if (is.null(type) || type == 1) { p <- ggplot2::ggplot(x) + ggplot2::aes(x = .data$Predicted) + - ggplot2::geom_smooth(ggplot2::aes(y = .data$V), linewidth = size_line, color = colors[2], se = FALSE) + - ggplot2::geom_smooth(ggplot2::aes(y = .data$Res2), linewidth = size_line, color = colors[1]) + + ggplot2::geom_smooth(ggplot2::aes(y = .data$V), linewidth = linewidth, color = colors[2], se = FALSE) + + ggplot2::geom_smooth(ggplot2::aes(y = .data$Res2), linewidth = linewidth, color = colors[1]) + ggplot2::labs( title = "Misspecified dispersion and zero-inflation", subtitle = "Observed residual variance (green) should follow predicted residual variance (blue)", diff --git a/R/plot.check_predictions.R b/R/plot.check_predictions.R index 4d9453892..e619fb60c 100644 --- a/R/plot.check_predictions.R +++ b/R/plot.check_predictions.R @@ -53,7 +53,7 @@ data_plot.performance_pp_check <- function(x, type = "density", ...) { #' #' The `plot()` method for the `performance::check_predictions()` function. #' -#' @param line_alpha Numeric value specifying alpha of lines indicating `yrep`. +#' @param alpha_line Numeric value specifying alpha of lines indicating `yrep`. #' @param style A ggplot2-theme. #' @param type Plot type for the posterior predictive checks plot. Can be `"density"` #' (default), `"discrete_dots"`, `"discrete_interval"` or `"discrete_both"` (the @@ -87,13 +87,13 @@ data_plot.performance_pp_check <- function(x, type = "density", ...) { #' plot(out, type = "discrete_dots") #' @export print.see_performance_pp_check <- function(x, - size_line = 0.5, + linewidth = 0.5, size_point = 2, size_bar = 0.7, size_axis_title = base_size, size_title = 12, base_size = 10, - line_alpha = 0.15, + alpha_line = 0.15, style = theme_lucid, colors = unname(social_colors(c("green", "blue"))), type = c("density", "discrete_dots", "discrete_interval", "discrete_both"), @@ -116,9 +116,9 @@ print.see_performance_pp_check <- function(x, p1 <- .plot_pp_check( x, - size_line = size_line, + linewidth = linewidth, size_point = size_point, - line_alpha = line_alpha, + alpha_line = alpha_line, theme_style = style, colors = colors, base_size = base_size, @@ -144,13 +144,13 @@ print.see_performance_pp_check <- function(x, #' @rdname print.see_performance_pp_check #' @export plot.see_performance_pp_check <- function(x, - size_line = 0.5, + linewidth = 0.5, size_point = 2, size_bar = 0.7, size_axis_title = base_size, size_title = 12, base_size = 10, - line_alpha = 0.15, + alpha_line = 0.15, style = theme_lucid, colors = unname(social_colors(c("green", "blue"))), type = c("density", "discrete_dots", "discrete_interval", "discrete_both"), @@ -173,9 +173,9 @@ plot.see_performance_pp_check <- function(x, p1 <- .plot_pp_check( x, - size_line = size_line, + linewidth = linewidth, size_point = size_point, - line_alpha = line_alpha, + alpha_line = alpha_line, theme_style = style, base_size = base_size, size_axis_title = size_axis_title, @@ -198,9 +198,9 @@ plot.see_performance_pp_check <- function(x, .plot_pp_check <- function(x, - size_line, + linewidth, size_point, - line_alpha, + alpha_line, theme_style, base_size = 10, size_axis_title = 10, @@ -215,7 +215,7 @@ plot.see_performance_pp_check <- function(x, # discrete plot type from "bayesplot::pp_check()" returns a different data # structure, so we need to handle it differently if (isTRUE(is_stan) && type != "density") { - return(.plot_check_predictions_stan_dots(x, colors, info, size_line, size_point, line_alpha, ...)) + return(.plot_check_predictions_stan_dots(x, colors, info, linewidth, size_point, alpha_line, ...)) } # default bandwidth, for smooting @@ -228,7 +228,7 @@ plot.see_performance_pp_check <- function(x, suggest_dots <- (minfo$is_bernoulli || minfo$is_count || minfo$is_ordinal || minfo$is_categorical) if (!is.null(type) && type %in% c("discrete_dots", "discrete_interval", "discrete_both") && suggest_dots) { - out <- .plot_check_predictions_dots(x, colors, info, size_line, size_point, line_alpha, type, ...) + out <- .plot_check_predictions_dots(x, colors, info, linewidth, size_point, alpha_line, type, ...) } else { if (suggest_dots) { insight::format_alert( @@ -237,7 +237,7 @@ plot.see_performance_pp_check <- function(x, ) } # denity plot - for models that have no binary or count/ordinal outcome - out <- .plot_check_predictions_density(x, colors, info, size_line, line_alpha, bandwidth, ...) + out <- .plot_check_predictions_density(x, colors, info, linewidth, alpha_line, bandwidth, ...) } @@ -271,8 +271,8 @@ plot.see_performance_pp_check <- function(x, .plot_check_predictions_density <- function(x, colors, info, - size_line, - line_alpha, + linewidth, + alpha_line, bandwidth, ...) { ggplot2::ggplot(x) + @@ -295,15 +295,15 @@ plot.see_performance_pp_check <- function(x, )) + ggplot2::scale_linewidth_manual( values = c( - "Observed data" = 1.7 * size_line, - "Model-predicted data" = size_line + "Observed data" = 1.7 * linewidth, + "Model-predicted data" = linewidth ), guide = "none" ) + ggplot2::scale_alpha_manual( values = c( "Observed data" = 1, - "Model-predicted data" = line_alpha + "Model-predicted data" = alpha_line ), guide = "none" ) + @@ -326,9 +326,9 @@ plot.see_performance_pp_check <- function(x, .plot_check_predictions_dots <- function(x, colors, info, - size_line, + linewidth, size_point, - line_alpha, + alpha_line, type = "discrete_dots", ...) { # make sure we have a factor, so "table()" generates frequencies for all levels @@ -378,7 +378,7 @@ plot.see_performance_pp_check <- function(x, ), position = ggplot2::position_nudge(x = 0.2), size = 0.4 * size_point, - linewidth = size_line, + linewidth = linewidth, stroke = 0, shape = 16 ) + @@ -409,7 +409,7 @@ plot.see_performance_pp_check <- function(x, group = .data$grp, color = .data$key ), - alpha = line_alpha, + alpha = alpha_line, position = ggplot2::position_jitter(width = 0.1, height = 0.02), size = 0.8 * size_point, stroke = 0, @@ -478,9 +478,9 @@ plot.see_performance_pp_check <- function(x, .plot_check_predictions_stan_dots <- function(x, colors, info, - size_line, + linewidth, size_point, - line_alpha, + alpha_line, ...) { # make sure we have a factor, so "table()" generates frequencies for all levels # for each group - we need tables of same size to bind data frames @@ -502,7 +502,7 @@ plot.see_performance_pp_check <- function(x, ), position = ggplot2::position_nudge(x = 0.2), size = 0.4 * size_point, - linewidth = size_line, + linewidth = linewidth, stroke = 0, shape = 16 ) + diff --git a/R/plot.compare_performance.R b/R/plot.compare_performance.R index c61c42fce..7fa5fb282 100644 --- a/R/plot.compare_performance.R +++ b/R/plot.compare_performance.R @@ -74,7 +74,7 @@ data_plot.compare_performance <- function(x, data = NULL, ...) { #' plot(result) #' #' @export -plot.see_compare_performance <- function(x, size_line = 1, ...) { +plot.see_compare_performance <- function(x, linewidth = 1, ...) { # We may think of plotting the "performance scores" as bar plots, # however, the "worst" model always has a score of zero, so no bar # is shown - this is rather confusing. One option might be to only @@ -104,7 +104,7 @@ plot.see_compare_performance <- function(x, size_line = 1, ...) { group = .data$Model, fill = .data$Model )) + - geom_polygon(linewidth = size_line, alpha = 0.05) + + geom_polygon(linewidth = linewidth, alpha = 0.05) + coord_radar() + scale_y_continuous(limits = c(0, 1), labels = NULL) + add_plot_attributes(x) + diff --git a/R/plot.describe_distribution.R b/R/plot.describe_distribution.R index 653c594a0..dd0dcd43e 100644 --- a/R/plot.describe_distribution.R +++ b/R/plot.describe_distribution.R @@ -34,13 +34,13 @@ data_plot.parameters_distribution <- function(x, data = NULL, ...) { #' #' @param dispersion Logical. If `TRUE`, a range of dispersion for #' each variable to the plot will be added. -#' @param dispersion_alpha Numeric value specifying the transparency level of dispersion ribbon. -#' @param dispersion_color Character specifying the color of dispersion ribbon. +#' @param alpha_dispersion Numeric value specifying the transparency level of dispersion ribbon. +#' @param color_dispersion Character specifying the color of dispersion ribbon. #' @param dispersion_style Character describing the style of dispersion area. #' `"ribbon"` for a ribbon, `"curve"` for a normal-curve. #' @param highlight A vector with names of categories in `x` that should be #' highlighted. -#' @param highlight_color A vector of color values for highlighted categories. +#' @param color_highlight A vector of color values for highlighted categories. #' The remaining (non-highlighted) categories will be filled with a lighter #' grey. #' @param size_bar Size of bar geoms. @@ -59,12 +59,12 @@ data_plot.parameters_distribution <- function(x, data = NULL, ...) { #' @export plot.see_parameters_distribution <- function(x, dispersion = FALSE, - dispersion_alpha = 0.3, - dispersion_color = "#3498db", + alpha_dispersion = 0.3, + color_dispersion = "#3498db", dispersion_style = c("ribbon", "curve"), size_bar = 0.7, highlight = NULL, - highlight_color = NULL, + color_highlight = NULL, ...) { # get data data <- .retrieve_data(x) @@ -84,24 +84,24 @@ plot.see_parameters_distribution <- function(x, lapply( x, .plot_see_parameters_distribution, - dispersion_alpha, - dispersion_color, + alpha_dispersion, + color_dispersion, dispersion_style, show_dispersion = dispersion, size_bar = size_bar, highlight = highlight, - highlight_color = highlight_color + color_highlight = color_highlight ) } else { .plot_see_parameters_distribution( x, - dispersion_alpha, - dispersion_color, + alpha_dispersion, + color_dispersion, dispersion_style, show_dispersion = dispersion, size_bar = size_bar, highlight = highlight, - highlight_color = highlight_color + color_highlight = color_highlight ) } } @@ -109,13 +109,13 @@ plot.see_parameters_distribution <- function(x, .plot_see_parameters_distribution <- function(x, - dispersion_alpha, - dispersion_color, + alpha_dispersion, + color_dispersion, dispersion_style, show_dispersion, size_bar, highlight, - highlight_color) { + color_highlight) { centrality <- attributes(x)$centrality dispersion <- attributes(x)$dispersion @@ -158,8 +158,8 @@ plot.see_parameters_distribution <- function(x, if (dispersion_style == "ribbon") { p <- p + geom_vline( xintercept = centrality, - colour = dispersion_color, - alpha = dispersion_alpha + colour = color_dispersion, + alpha = alpha_dispersion ) } if (!is.null(dispersion)) { @@ -169,8 +169,8 @@ plot.see_parameters_distribution <- function(x, geom_vline( xintercept = .range, linetype = "dashed", - colour = dispersion_color, - alpha = dispersion_alpha + colour = color_dispersion, + alpha = alpha_dispersion ) + annotate( "rect", @@ -178,15 +178,15 @@ plot.see_parameters_distribution <- function(x, xmax = .range[2], ymin = 0, ymax = Inf, - fill = dispersion_color, - alpha = (dispersion_alpha / 3) + fill = color_dispersion, + alpha = (alpha_dispersion / 3) ) } else { p <- p + geom_ribbon( aes(ymin = 0, ymax = .data$curve_y), - alpha = dispersion_alpha, - fill = dispersion_color, + alpha = alpha_dispersion, + fill = color_dispersion, colour = NA ) } @@ -194,15 +194,15 @@ plot.see_parameters_distribution <- function(x, } if (!is.null(x$highlight)) { - if (is.null(highlight_color)) { - highlight_color <- palette_material("full")(insight::n_unique(x$highlight) - 1L) + if (is.null(color_highlight)) { + color_highlight <- palette_material("full")(insight::n_unique(x$highlight) - 1L) } - names(highlight_color) <- highlight - highlight_color <- c(highlight_color, no_highlight = "grey70") + names(color_highlight) <- highlight + color_highlight <- c(color_highlight, no_highlight = "grey70") p <- p + - scale_fill_manual(values = highlight_color) + + scale_fill_manual(values = color_highlight) + guides(fill = "none") } diff --git a/R/plot.dw_data_tabulate.R b/R/plot.dw_data_tabulate.R index 768e69de5..3b133d643 100644 --- a/R/plot.dw_data_tabulate.R +++ b/R/plot.dw_data_tabulate.R @@ -12,7 +12,7 @@ #' If `TRUE`, confidence intervals computed using the Wilson method are shown. #' See Brown et al. (2001) for details. #' @param ci Confidence Interval (CI) level. Defaults to `0.95` (`95%`). -#' @param fill_col Color to use for category columns (default: `"#87CEFA"`). +#' @param color_fill Color to use for category columns (default: `"#87CEFA"`). #' @param color_error_bar Color to use for error bars (default: `"#607B8B"`). #' @param ... Unused #' @@ -29,7 +29,7 @@ plot.datawizard_tables <- function(x, label_values = TRUE, na_label = "(Missing)", error_bar = TRUE, ci = 0.95, - fill_col = "#87CEFA", + color_fill = "#87CEFA", color_error_bar = "#607B8B", ...) { show_na <- match.arg(show_na, choices = c("if_any", "always", "never")) @@ -41,7 +41,7 @@ plot.datawizard_tables <- function(x, label_values = TRUE, na_label = na_label, error_bar = error_bar, ci = ci, - fill_col = fill_col, + color_fill = color_fill, color_error_bar = color_error_bar ) } else { @@ -53,7 +53,7 @@ plot.datawizard_tables <- function(x, label_values = TRUE, na_label = na_label, error_bar = error_bar, ci = ci, - fill_col = fill_col, + color_fill = color_fill, color_error_bar = color_error_bar ) } @@ -68,7 +68,7 @@ plot.datawizard_table <- function(x, label_values = TRUE, na_label = "(Missing)", error_bar = TRUE, ci = 0.95, - fill_col = "#87CEFA", + color_fill = "#87CEFA", color_error_bar = "#607B8B", ...) { show_na <- match.arg(show_na, choices = c("if_any", "always", "never")) @@ -108,7 +108,7 @@ plot.datawizard_table <- function(x, label_values = TRUE, out <- ggplot2::ggplot(dat) + ggplot2::aes(x = .data$Value, y = .data$N) + - ggplot2::geom_col(fill = fill_col) + + ggplot2::geom_col(fill = color_fill) + ggplot2::labs(title = unique(dat$Variable)) + theme_modern() diff --git a/R/plot.equivalence_test.R b/R/plot.equivalence_test.R index 3a3eca517..24d94b595 100644 --- a/R/plot.equivalence_test.R +++ b/R/plot.equivalence_test.R @@ -15,8 +15,8 @@ #' plot(result) #' @export plot.see_equivalence_test <- function(x, - rope_color = "#0171D3", - rope_alpha = 0.2, + color_rope = "#0171D3", + alpha_rope = 0.2, show_intercept = FALSE, n_columns = 1, ...) { @@ -132,7 +132,7 @@ plot.see_equivalence_test <- function(x, if ("legend.title" %in% names(add.args)) legend.title <- eval(add.args[["legend.title"]]) if ("labels" %in% names(add.args)) axis_labels <- eval(add.args[["labels"]]) - rope.line.alpha <- 1.25 * rope_alpha + rope.line.alpha <- 1.25 * alpha_rope if (rope.line.alpha > 1) rope.line.alpha <- 1 insight::check_if_installed("ggridges") @@ -144,20 +144,20 @@ plot.see_equivalence_test <- function(x, xmax = .rope[2], ymin = 0, ymax = Inf, - fill = rope_color, - alpha = (rope_alpha / 3), + fill = color_rope, + alpha = (alpha_rope / 3), na.rm = TRUE ) + geom_vline( xintercept = .rope, linetype = "dashed", - colour = rope_color, + colour = color_rope, alpha = rope.line.alpha, na.rm = TRUE ) + geom_vline( xintercept = 0, - colour = rope_color, + colour = color_rope, linewidth = 0.8, alpha = rope.line.alpha, na.rm = TRUE @@ -207,8 +207,8 @@ plot.see_equivalence_test <- function(x, #' @export plot.see_equivalence_test_df <- function(x, - rope_color = "#0171D3", - rope_alpha = 0.2, + color_rope = "#0171D3", + alpha_rope = 0.2, data = NULL, n_columns = 1, ...) { @@ -277,7 +277,7 @@ plot.see_equivalence_test_df <- function(x, if ("legend.title" %in% names(add.args)) legend.title <- eval(add.args[["legend.title"]]) if ("labels" %in% names(add.args)) axis_labels <- eval(add.args[["labels"]]) - rope.line.alpha <- 1.25 * rope_alpha + rope.line.alpha <- 1.25 * alpha_rope if (rope.line.alpha > 1) rope.line.alpha <- 1 @@ -290,19 +290,19 @@ plot.see_equivalence_test_df <- function(x, xmax = .rope[2], ymin = 0, ymax = Inf, - fill = rope_color, - alpha = (rope_alpha / 3) + fill = color_rope, + alpha = (alpha_rope / 3) ) + geom_vline( xintercept = .rope, linetype = "dashed", - colour = rope_color, + colour = color_rope, alpha = rope.line.alpha, na.rm = TRUE ) + geom_vline( xintercept = 0, - colour = rope_color, + colour = color_rope, linewidth = 0.8, alpha = rope.line.alpha, na.rm = TRUE @@ -333,8 +333,8 @@ plot.see_equivalence_test_df <- function(x, #' @export plot.see_equivalence_test_lm <- function(x, size_point = 0.7, - rope_color = "#0171D3", - rope_alpha = 0.2, + color_rope = "#0171D3", + alpha_rope = 0.2, show_intercept = FALSE, n_columns = 1, ...) { @@ -393,7 +393,7 @@ plot.see_equivalence_test_lm <- function(x, if ("x.title" %in% names(add.args)) x.title <- eval(add.args[["x.title"]]) if ("legend.title" %in% names(add.args)) legend.title <- eval(add.args[["legend.title"]]) - rope.line.alpha <- 1.25 * rope_alpha + rope.line.alpha <- 1.25 * alpha_rope if (rope.line.alpha > 1) rope.line.alpha <- 1 p <- ggplot( @@ -412,20 +412,20 @@ plot.see_equivalence_test_lm <- function(x, xmax = .rope[2], ymin = 0, ymax = Inf, - fill = rope_color, - alpha = (rope_alpha / 3) + fill = color_rope, + alpha = (alpha_rope / 3) ) + geom_vline( xintercept = .rope, linetype = "dashed", - colour = rope_color, + colour = color_rope, linewidth = 0.8, alpha = rope.line.alpha, na.rm = TRUE ) + geom_vline( xintercept = 0, - colour = rope_color, + colour = color_rope, linewidth = 0.8, alpha = rope.line.alpha, na.rm = TRUE diff --git a/R/plot.estimate_density.R b/R/plot.estimate_density.R index bc2883360..4371f383d 100644 --- a/R/plot.estimate_density.R +++ b/R/plot.estimate_density.R @@ -74,9 +74,9 @@ data_plot.estimate_density <- function(x, #' @param priors Logical. If `TRUE`, prior distributions are simulated #' (using [bayestestR::simulate_prior()]) and added #' to the plot. -#' @param priors_alpha Numeric value specifying alpha for the prior +#' @param alpha_priors Numeric value specifying alpha for the prior #' distributions. -#' @param posteriors_alpha Numeric value specifying alpha for the posterior +#' @param alpha_posteriors Numeric value specifying alpha for the posterior #' distributions. #' @param centrality Character specifying the point-estimate (centrality index) #' to compute. Can be `"median"`, `"mean"` or `"MAP"`. @@ -103,9 +103,9 @@ plot.see_estimate_density <- function(x, show_intercept = FALSE, n_columns = 1, priors = FALSE, - priors_alpha = 0.4, - posteriors_alpha = 0.7, - size_line = 0.9, + alpha_priors = 0.4, + alpha_posteriors = 0.7, + linewidth = 0.9, size_point = 2, centrality = "median", ci = 0.95, @@ -144,7 +144,7 @@ plot.see_estimate_density <- function(x, if (stack) { p <- ggplot(x, aes(x = .data$x, y = .data$y, color = .data$Parameter)) + - geom_line(linewidth = size_line) + + geom_line(linewidth = linewidth) + add_plot_attributes(x) + scale_color_flat(labels = parameter_labels) } else { @@ -159,11 +159,11 @@ plot.see_estimate_density <- function(x, model, parameter = params, show_intercept = show_intercept, - priors_alpha = priors_alpha, + alpha_priors = alpha_priors, show_ridge_line = FALSE ) + ggridges::geom_ridgeline(aes(fill = "Posterior"), - alpha = posteriors_alpha, + alpha = alpha_posteriors, color = NA ) + guides(color = "none") + @@ -174,7 +174,7 @@ plot.see_estimate_density <- function(x, p <- p + ggridges::geom_ridgeline(aes(fill = "Posterior"), - alpha = posteriors_alpha, + alpha = alpha_posteriors, color = NA ) + guides(fill = "none", color = "none") + @@ -194,7 +194,7 @@ plot.see_estimate_density <- function(x, xmax = .data$CI_high, color = "Posterior" ), - linewidth = size_line + linewidth = linewidth ) + geom_point( data = my_summary, @@ -247,14 +247,14 @@ data_plot.estimate_density_df <- data_plot.estimate_density plot.see_estimate_density_df <- function(x, stack = TRUE, n_columns = 1, - size_line = 0.9, + linewidth = 0.9, ...) { x$Parameter <- factor(x$Parameter, levels = rev(unique(x$Parameter))) parameter_labels <- stats::setNames(levels(x$Parameter), levels(x$Parameter)) if (stack) { p <- ggplot(x, aes(x = .data$x, y = .data$y, color = .data$Parameter)) + - geom_line(linewidth = size_line) + geom_line(linewidth = linewidth) } else { insight::check_if_installed("ggridges") diff --git a/R/plot.p_direction.R b/R/plot.p_direction.R index 56dc24f3a..48496e320 100644 --- a/R/plot.p_direction.R +++ b/R/plot.p_direction.R @@ -166,7 +166,7 @@ plot.see_p_direction <- function(x, data = NULL, show_intercept = FALSE, priors = FALSE, - priors_alpha = 0.4, + alpha_priors = 0.4, n_columns = 1, ...) { # save model for later use @@ -209,7 +209,7 @@ plot.see_p_direction <- function(x, model, parameter = params, show_intercept = show_intercept, - priors_alpha = priors_alpha + alpha_priors = alpha_priors ) } diff --git a/R/plot.p_function.R b/R/plot.p_function.R index 878fe08d1..8fddd6277 100644 --- a/R/plot.p_function.R +++ b/R/plot.p_function.R @@ -6,7 +6,7 @@ #' @param colors Character vector of length two, indicating the colors (in #' hex-format) used when only one parameter is plotted, resp. when panels #' are plotted as facets. -#' @param line_alpha Numeric value specifying alpha of lines indicating the +#' @param alpha_line Numeric value specifying alpha of lines indicating the #' emphasized compatibility interval levels (see `?parameters::p_function`). #' #' @inheritParams data_plot @@ -29,9 +29,9 @@ plot.see_p_function <- function(x, colors = c("black", "#1b6ca8"), size_point = 1.2, - size_line = c(0.7, 0.9), + linewidth = c(0.7, 0.9), size_text = 3, - line_alpha = 0.15, + alpha_line = 0.15, show_labels = TRUE, n_columns = NULL, show_intercept = FALSE, @@ -55,10 +55,10 @@ plot.see_p_function <- function(x, # make sure group is factor data_ci_segments$group <- as.factor(data_ci_segments$group) - # sanity check - size_line must be of length two, when we have more than + # sanity check - linewidth must be of length two, when we have more than # one group (i.e. when we emphasize CI lines) - if (length(size_line) != 2 && insight::n_unique(data_ci_segments$group) == 2) { - insight::format_error("Length of `size_line` must of length 2, to match regular and emphasized interval lines.") # nolint + if (length(linewidth) != 2 && insight::n_unique(data_ci_segments$group) == 2) { + insight::format_error("Length of `linewidth` must of length 2, to match regular and emphasized interval lines.") # nolint } # setup - no color/fill aes for ribbons when we have no facets @@ -103,7 +103,7 @@ plot.see_p_function <- function(x, ), colour = colors[1], size = size_point, - alpha = line_alpha, + alpha = alpha_line, show.legend = FALSE ) + # points for vertical CI bars @@ -116,7 +116,7 @@ plot.see_p_function <- function(x, ), colour = colors[1], size = size_point, - alpha = line_alpha, + alpha = alpha_line, show.legend = FALSE ) + # lines for vertical CI bars @@ -131,7 +131,7 @@ plot.see_p_function <- function(x, linewidth = .data$group ), colour = colors[1], - alpha = line_alpha, + alpha = alpha_line, show.legend = FALSE ) @@ -168,7 +168,7 @@ plot.see_p_function <- function(x, # labelling ggplot2::labs(y = expression(paste(italic("p"), "-value")), x = "Range of Estimates", colour = NULL) + theme_lucid() + - ggplot2::scale_linewidth_manual(values = size_line, guide = "none") + ggplot2::scale_linewidth_manual(values = linewidth, guide = "none") # facets for grids, different color/fill when no grids if (!is.null(n_columns)) { diff --git a/R/plot.p_significance.R b/R/plot.p_significance.R index e8a62e791..1348c1333 100644 --- a/R/plot.p_significance.R +++ b/R/plot.p_significance.R @@ -191,7 +191,7 @@ plot.see_p_significance <- function(x, data = NULL, show_intercept = FALSE, priors = FALSE, - priors_alpha = 0.4, + alpha_priors = 0.4, n_columns = 1, ...) { # save model for later use @@ -235,7 +235,7 @@ plot.see_p_significance <- function(x, model, parameter = params, show_intercept = show_intercept, - priors_alpha = priors_alpha + alpha_priors = alpha_priors ) + scale_fill_manual(values = c("white", "#FFFC00", "#cd201f", "#0077B5")) } else { diff --git a/R/plot.parameters_brms_meta.R b/R/plot.parameters_brms_meta.R index 25444f991..ea194f296 100644 --- a/R/plot.parameters_brms_meta.R +++ b/R/plot.parameters_brms_meta.R @@ -140,11 +140,11 @@ data_plot.parameters_brms_meta <- function(x, data = NULL, normalize_height = TR #' @export plot.see_parameters_brms_meta <- function(x, size_point = 2, - size_line = 0.8, + linewidth = 0.8, size_text = 3.5, - posteriors_alpha = 0.7, - rope_alpha = 0.15, - rope_color = "cadetblue", + alpha_posteriors = 0.7, + alpha_rope = 0.15, + color_rope = "cadetblue", normalize_height = TRUE, show_labels = TRUE, ...) { @@ -175,8 +175,8 @@ plot.see_parameters_brms_meta <- function(x, xmax = rope[2], ymin = 0, ymax = Inf, - fill = rope_color, - alpha = rope_alpha + fill = color_rope, + alpha = alpha_rope ) } @@ -187,7 +187,7 @@ plot.see_parameters_brms_meta <- function(x, mapping = ggplot2::aes(fill = .data$Group), color = NA, scale = 1, - alpha = posteriors_alpha + alpha = alpha_posteriors ) + ggplot2::geom_errorbarh( data = datasummary, @@ -196,7 +196,7 @@ plot.see_parameters_brms_meta <- function(x, xmax = .data$CI_high, color = .data$Color ), - linewidth = size_line + linewidth = linewidth ) + ggplot2::geom_point( data = datasummary, diff --git a/R/plot.parameters_pca.R b/R/plot.parameters_pca.R index 8d754ca67..aa847bf1c 100644 --- a/R/plot.parameters_pca.R +++ b/R/plot.parameters_pca.R @@ -61,7 +61,7 @@ data_plot.parameters_efa <- data_plot.parameters_pca #' Options are three different shapes to represent component loadings; #' `"bar"` (default) for a horizontal bar chart, or #' `"line"` for a horizontal point and line chart. -#' @param text_color Character specifying color of text labels. +#' @param color_text Character specifying color of text labels. #' @inheritParams data_plot #' @inheritParams plot.see_bayesfactor_parameters #' @inheritParams plot.see_check_outliers @@ -80,7 +80,7 @@ data_plot.parameters_efa <- data_plot.parameters_pca plot.see_parameters_pca <- function(x, type = c("bar", "line"), size_text = 3.5, - text_color = "black", + color_text = "black", size = 1, show_labels = TRUE, ...) { @@ -123,7 +123,7 @@ plot.see_parameters_pca <- function(x, p <- p + geom_text( aes(x = abs(.data$y), label = round(.data$y, 2)), - color = text_color, + color = color_text, size = size_text, nudge_y = 0.15 ) diff --git a/R/plot.parameters_simulate.R b/R/plot.parameters_simulate.R index 38e221827..a99edcc92 100644 --- a/R/plot.parameters_simulate.R +++ b/R/plot.parameters_simulate.R @@ -90,8 +90,8 @@ plot.see_parameters_simulate <- function(x, show_intercept = FALSE, n_columns = NULL, normalize_height = FALSE, - size_line = 0.9, - posteriors_alpha = 0.7, + linewidth = 0.9, + alpha_posteriors = 0.7, centrality = "median", ci = 0.95, ...) { @@ -114,8 +114,8 @@ plot.see_parameters_simulate <- function(x, stack = stack, show_intercept = show_intercept, n_columns = n_columns, - size_line = size_line, - posteriors_alpha = posteriors_alpha, + linewidth = linewidth, + alpha_posteriors = alpha_posteriors, centrality = centrality, ci = ci, ... diff --git a/R/plot.performance_simres.R b/R/plot.performance_simres.R index a8d96d010..1dc95307e 100644 --- a/R/plot.performance_simres.R +++ b/R/plot.performance_simres.R @@ -31,13 +31,13 @@ #' #' @export plot.see_performance_simres <- function(x, - size_line = 0.8, + linewidth = 0.8, size_point = 2, size_title = 12, size_axis_title = base_size, base_size = 10, alpha = 0.2, - dot_alpha = 0.8, + alpha_dot = 0.8, colors = c("#3aaf85", "#1b6ca8"), detrend = FALSE, transform = NULL, @@ -97,7 +97,7 @@ plot.see_performance_simres <- function(x, qqplotr::stat_qq_line( distribution = dfun, dparams = dp, - size = size_line, + size = linewidth, colour = colors[1], detrend = detrend ), @@ -105,7 +105,7 @@ plot.see_performance_simres <- function(x, distribution = dfun, dparams = dp, size = size_point, - alpha = dot_alpha, + alpha = alpha_dot, colour = colors[2], detrend = detrend ) @@ -127,7 +127,7 @@ plot.see_performance_simres <- function(x, colour = colors[2] ), ggplot2::geom_qq_line( - linewidth = size_line, + linewidth = linewidth, colour = colors[1], na.rm = TRUE, distribution = dfun, diff --git a/R/plot.point_estimates.R b/R/plot.point_estimates.R index 466cf3356..bf1af45f4 100644 --- a/R/plot.point_estimates.R +++ b/R/plot.point_estimates.R @@ -106,7 +106,7 @@ plot.see_point_estimate <- function(x, show_labels = TRUE, show_intercept = FALSE, priors = FALSE, - priors_alpha = 0.4, + alpha_priors = 0.4, ...) { # save model for later use model <- .retrieve_data(x) @@ -149,18 +149,18 @@ plot.see_point_estimate <- function(x, model, parameter = x_lab, show_intercept = show_intercept, - priors_alpha = priors_alpha, + alpha_priors = alpha_priors, fill_color = "#FF9800" ) - posterior_alpha <- 0.7 + alpha_posteriors <- 0.7 } else { - posterior_alpha <- 1 + alpha_posteriors <- 1 } p_object <- p_object + geom_ribbon(aes(ymin = 0, ymax = .data$y), fill = "#FFC107", - alpha = posterior_alpha + alpha = alpha_posteriors ) if (!is.null(mean_x) && !is.null(mean_y)) { @@ -172,14 +172,14 @@ plot.see_point_estimate <- function(x, yend = mean_y, color = "#E91E63", linewidth = 1, - alpha = posterior_alpha + alpha = alpha_posteriors ) + geom_point( x = mean_x, y = mean_y, color = "#E91E63", size = size_point, - alpha = posterior_alpha + alpha = alpha_posteriors ) if (show_labels) { p_object <- p_object + @@ -202,14 +202,14 @@ plot.see_point_estimate <- function(x, yend = median_y, color = "#2196F3", linewidth = 1, - alpha = posterior_alpha + alpha = alpha_posteriors ) + geom_point( x = median_x, y = median_y, color = "#2196F3", size = size_point, - alpha = posterior_alpha + alpha = alpha_posteriors ) if (show_labels) { p_object <- p_object + @@ -232,14 +232,14 @@ plot.see_point_estimate <- function(x, yend = map_y, color = "#4CAF50", linewidth = 1, - alpha = posterior_alpha + alpha = alpha_posteriors ) + geom_point( x = map_x, y = map_y, color = "#4CAF50", size = size_point, - alpha = posterior_alpha + alpha = alpha_posteriors ) if (show_labels) { p_object <- p_object + diff --git a/R/plot.rope.R b/R/plot.rope.R index c7b79e3ae..5bc7ec81f 100644 --- a/R/plot.rope.R +++ b/R/plot.rope.R @@ -87,8 +87,8 @@ data_plot.rope <- function(x, data = NULL, show_intercept = FALSE, ...) { #' @export plot.see_rope <- function(x, data = NULL, - rope_alpha = 0.5, - rope_color = "cadetblue", + alpha_rope = 0.5, + color_rope = "cadetblue", show_intercept = FALSE, n_columns = 1, ...) { @@ -122,8 +122,8 @@ plot.see_rope <- function(x, xmax = attributes(x)$info$rope_range[2], ymin = 0, ymax = Inf, - fill = rope_color, - alpha = rope_alpha + fill = color_rope, + alpha = alpha_rope ) + add_plot_attributes(x) diff --git a/R/plot.si.R b/R/plot.si.R index 3e7edfa06..1289dc571 100644 --- a/R/plot.si.R +++ b/R/plot.si.R @@ -2,8 +2,8 @@ #' #' The `plot()` method for the `bayestestR::si()`. #' -#' @param si_alpha Numeric value specifying Transparency level of SI ribbon. -#' @param si_color Character specifying color of SI ribbon. +#' @param alpha_si Numeric value specifying Transparency level of SI ribbon. +#' @param color_si Character specifying color of SI ribbon. #' @param support_only Logical. Decides whether to plot only the support data, #' or show the "raw" prior and posterior distributions? Only applies when #' plotting [bayestestR::si()]. @@ -23,8 +23,8 @@ #' #' @export plot.see_si <- function(x, - si_color = "#0171D3", - si_alpha = 0.2, + color_si = "#0171D3", + alpha_si = 0.2, show_intercept = FALSE, support_only = FALSE, ...) { @@ -47,7 +47,7 @@ plot.see_si <- function(x, aes(xmin = .data$CI_low, xmax = .data$CI_high, alpha = .data$CI), ymin = 0, ymax = Inf, data = x, - fill = si_color, + fill = color_si, inherit.aes = FALSE ) + scale_alpha_continuous(breaks = unique(x$CI)) + @@ -65,7 +65,7 @@ plot.see_si <- function(x, aes(xmin = .data$CI_low, xmax = .data$CI_high), ymin = 0, ymax = Inf, data = x, - fill = si_color, alpha = si_alpha, + fill = color_si, alpha = alpha_si, linetype = "dashed", colour = "grey50", inherit.aes = FALSE ) + diff --git a/R/utils_add_prior_layer.R b/R/utils_add_prior_layer.R index 90b0dbbac..3ac51a32e 100644 --- a/R/utils_add_prior_layer.R +++ b/R/utils_add_prior_layer.R @@ -1,7 +1,7 @@ .add_prior_layer_ridgeline <- function(model, parameter = NULL, show_intercept = FALSE, - priors_alpha = 0.5, + alpha_priors = 0.5, fill_color = NULL, show_ridge_line = TRUE) { dat <- tryCatch( @@ -42,7 +42,7 @@ group = as.factor(.data$Parameter) ), fill = fill_color, - alpha = priors_alpha, + alpha = alpha_priors, na.rm = TRUE ) } else { @@ -55,7 +55,7 @@ group = as.factor(.data$Parameter) ), fill = fill_color, - alpha = priors_alpha, + alpha = alpha_priors, color = NA, na.rm = TRUE ) @@ -70,7 +70,7 @@ group = as.factor(.data$Parameter), fill = "Priors" ), - alpha = priors_alpha, + alpha = alpha_priors, na.rm = TRUE ) } else { @@ -83,7 +83,7 @@ group = as.factor(.data$Parameter), fill = "Priors" ), - alpha = priors_alpha, + alpha = alpha_priors, color = NA, na.rm = TRUE ) @@ -98,7 +98,7 @@ .add_prior_layer_ribbon <- function(model, parameter = NULL, show_intercept = FALSE, - priors_alpha = 0.5, + alpha_priors = 0.5, fill_color = NULL) { dat <- tryCatch( { @@ -135,7 +135,7 @@ group = as.factor(.data$Parameter) ), fill = fill_color, - alpha = priors_alpha + alpha = alpha_priors ) } else { geom_ribbon( @@ -147,7 +147,7 @@ group = as.factor(.data$Parameter), fill = "Prior" ), - alpha = priors_alpha + alpha = alpha_priors ) } } diff --git a/man/plot.datawizard_table.Rd b/man/plot.datawizard_table.Rd index 23d978982..7223a92b1 100644 --- a/man/plot.datawizard_table.Rd +++ b/man/plot.datawizard_table.Rd @@ -12,7 +12,7 @@ na_label = "(Missing)", error_bar = TRUE, ci = 0.95, - fill_col = "#87CEFA", + color_fill = "#87CEFA", color_error_bar = "#607B8B", ... ) @@ -24,7 +24,7 @@ na_label = "(Missing)", error_bar = TRUE, ci = 0.95, - fill_col = "#87CEFA", + color_fill = "#87CEFA", color_error_bar = "#607B8B", ... ) @@ -48,7 +48,7 @@ See Brown et al. (2001) for details.} \item{ci}{Confidence Interval (CI) level. Defaults to \code{0.95} (\verb{95\%}).} -\item{fill_col}{Color to use for category columns (default: \code{"#87CEFA"}).} +\item{color_fill}{Color to use for category columns (default: \code{"#87CEFA"}).} \item{color_error_bar}{Color to use for error bars (default: \code{"#607B8B"}).} diff --git a/man/plot.see_bayesfactor_parameters.Rd b/man/plot.see_bayesfactor_parameters.Rd index ea524c530..01fe5aa4a 100644 --- a/man/plot.see_bayesfactor_parameters.Rd +++ b/man/plot.see_bayesfactor_parameters.Rd @@ -7,8 +7,8 @@ \method{plot}{see_bayesfactor_parameters}( x, size_point = 2, - rope_color = "#0171D3", - rope_alpha = 0.2, + color_rope = "#0171D3", + alpha_rope = 0.2, show_intercept = FALSE, ... ) @@ -18,9 +18,9 @@ \item{size_point}{Numeric specifying size of point-geoms.} -\item{rope_color}{Character specifying color of ROPE ribbon.} +\item{color_rope}{Character specifying color of ROPE ribbon.} -\item{rope_alpha}{Numeric specifying transparency level of ROPE ribbon.} +\item{alpha_rope}{Numeric specifying transparency level of ROPE ribbon.} \item{show_intercept}{Logical, if \code{TRUE}, the intercept-parameter is included in the plot. By default, it is hidden because in many cases the diff --git a/man/plot.see_check_collinearity.Rd b/man/plot.see_check_collinearity.Rd index b5e79d000..d4b1647d4 100644 --- a/man/plot.see_check_collinearity.Rd +++ b/man/plot.see_check_collinearity.Rd @@ -9,7 +9,7 @@ data = NULL, colors = c("#3aaf85", "#1b6ca8", "#cd201f"), size_point = 3.5, - size_line = 0.8, + linewidth = 0.8, size_title = 12, size_axis_title = base_size, base_size = 10, @@ -27,7 +27,7 @@ hex-format) for points and line.} \item{size_point}{Numeric specifying size of point-geoms.} -\item{size_line}{Numeric value specifying size of line geoms.} +\item{linewidth}{Numeric value specifying size of line geoms.} \item{base_size, size_axis_title, size_title}{Numeric value specifying size of axis and plot titles.} diff --git a/man/plot.see_check_heteroscedasticity.Rd b/man/plot.see_check_heteroscedasticity.Rd index 6fa0b472b..5ac6a1805 100644 --- a/man/plot.see_check_heteroscedasticity.Rd +++ b/man/plot.see_check_heteroscedasticity.Rd @@ -8,7 +8,7 @@ x, data = NULL, size_point = 2, - size_line = 0.8, + linewidth = 0.8, size_title = 12, size_axis_title = base_size, base_size = 10, @@ -23,7 +23,7 @@ statistical model.} \item{size_point}{Numeric specifying size of point-geoms.} -\item{size_line}{Numeric value specifying size of line geoms.} +\item{linewidth}{Numeric value specifying size of line geoms.} \item{base_size, size_axis_title, size_title}{Numeric value specifying size of axis and plot titles.} diff --git a/man/plot.see_check_normality.Rd b/man/plot.see_check_normality.Rd index 6f6447c7d..137a9bcf0 100644 --- a/man/plot.see_check_normality.Rd +++ b/man/plot.see_check_normality.Rd @@ -8,13 +8,13 @@ x, type = c("qq", "pp", "density"), data = NULL, - size_line = 0.8, + linewidth = 0.8, size_point = 2, size_title = 12, size_axis_title = base_size, base_size = 10, alpha = 0.2, - dot_alpha = 0.8, + alpha_dot = 0.8, colors = c("#3aaf85", "#1b6ca8"), detrend = TRUE, method = "ell", @@ -32,7 +32,7 @@ Options are \code{"qq"} (default) for quantile-quantile (Q-Q) plots, \item{data}{The original data used to create this object. Can be a statistical model.} -\item{size_line}{Numeric value specifying size of line geoms.} +\item{linewidth}{Numeric value specifying size of line geoms.} \item{size_point}{Numeric specifying size of point-geoms.} @@ -41,7 +41,7 @@ axis and plot titles.} \item{alpha}{Numeric value specifying alpha level of the confidence bands.} -\item{dot_alpha}{Numeric value specifying alpha level of the point geoms.} +\item{alpha_dot}{Numeric value specifying alpha level of the point geoms.} \item{colors}{Character vector of length two, indicating the colors (in hex-format) for points and line.} diff --git a/man/plot.see_check_outliers.Rd b/man/plot.see_check_outliers.Rd index 1b839ff3f..f1b47e2ba 100644 --- a/man/plot.see_check_outliers.Rd +++ b/man/plot.see_check_outliers.Rd @@ -7,11 +7,11 @@ \method{plot}{see_check_outliers}( x, size_text = 3.5, - size_line = 0.8, + linewidth = 0.8, size_title = 12, size_axis_title = base_size, base_size = 10, - dot_alpha = 0.8, + alpha_dot = 0.8, colors = c("#3aaf85", "#1b6ca8", "#cd201f"), rescale_distance = TRUE, type = c("dots", "bars"), @@ -24,12 +24,12 @@ \item{size_text}{Numeric value specifying size of text labels.} -\item{size_line}{Numeric value specifying size of line geoms.} +\item{linewidth}{Numeric value specifying size of line geoms.} \item{base_size, size_axis_title, size_title}{Numeric value specifying size of axis and plot titles.} -\item{dot_alpha}{Numeric value specifying alpha level of the point geoms.} +\item{alpha_dot}{Numeric value specifying alpha level of the point geoms.} \item{colors}{Character vector of length two, indicating the colors (in hex-format) for points and line.} diff --git a/man/plot.see_compare_performance.Rd b/man/plot.see_compare_performance.Rd index 351e46ebf..b44f5849b 100644 --- a/man/plot.see_compare_performance.Rd +++ b/man/plot.see_compare_performance.Rd @@ -4,12 +4,12 @@ \alias{plot.see_compare_performance} \title{Plot method for comparing model performances} \usage{ -\method{plot}{see_compare_performance}(x, size_line = 1, ...) +\method{plot}{see_compare_performance}(x, linewidth = 1, ...) } \arguments{ \item{x}{An object.} -\item{size_line}{Numeric value specifying size of line geoms.} +\item{linewidth}{Numeric value specifying size of line geoms.} \item{...}{Arguments passed to or from other methods.} } diff --git a/man/plot.see_equivalence_test.Rd b/man/plot.see_equivalence_test.Rd index 573bf9580..528abdd70 100644 --- a/man/plot.see_equivalence_test.Rd +++ b/man/plot.see_equivalence_test.Rd @@ -11,8 +11,8 @@ \method{plot}{see_equivalence_test}( x, - rope_color = "#0171D3", - rope_alpha = 0.2, + color_rope = "#0171D3", + alpha_rope = 0.2, show_intercept = FALSE, n_columns = 1, ... @@ -21,8 +21,8 @@ \method{plot}{see_equivalence_test_lm}( x, size_point = 0.7, - rope_color = "#0171D3", - rope_alpha = 0.2, + color_rope = "#0171D3", + alpha_rope = 0.2, show_intercept = FALSE, n_columns = 1, ... @@ -33,9 +33,9 @@ \item{...}{Arguments passed to or from other methods.} -\item{rope_color}{Character specifying color of ROPE ribbon.} +\item{color_rope}{Character specifying color of ROPE ribbon.} -\item{rope_alpha}{Numeric specifying transparency level of ROPE ribbon.} +\item{alpha_rope}{Numeric specifying transparency level of ROPE ribbon.} \item{show_intercept}{Logical, if \code{TRUE}, the intercept-parameter is included in the plot. By default, it is hidden because in many cases the diff --git a/man/plot.see_estimate_density.Rd b/man/plot.see_estimate_density.Rd index 0f0936797..e33857d08 100644 --- a/man/plot.see_estimate_density.Rd +++ b/man/plot.see_estimate_density.Rd @@ -10,9 +10,9 @@ show_intercept = FALSE, n_columns = 1, priors = FALSE, - priors_alpha = 0.4, - posteriors_alpha = 0.7, - size_line = 0.9, + alpha_priors = 0.4, + alpha_posteriors = 0.7, + linewidth = 0.9, size_point = 2, centrality = "median", ci = 0.95, @@ -39,13 +39,13 @@ panel-layout. If \code{NULL}, a single, integrated plot is shown.} (using \code{\link[bayestestR:simulate_prior]{bayestestR::simulate_prior()}}) and added to the plot.} -\item{priors_alpha}{Numeric value specifying alpha for the prior +\item{alpha_priors}{Numeric value specifying alpha for the prior distributions.} -\item{posteriors_alpha}{Numeric value specifying alpha for the posterior +\item{alpha_posteriors}{Numeric value specifying alpha for the posterior distributions.} -\item{size_line}{Numeric value specifying size of line geoms.} +\item{linewidth}{Numeric value specifying size of line geoms.} \item{size_point}{Numeric specifying size of point-geoms.} diff --git a/man/plot.see_p_direction.Rd b/man/plot.see_p_direction.Rd index 58c360cdc..044b9c290 100644 --- a/man/plot.see_p_direction.Rd +++ b/man/plot.see_p_direction.Rd @@ -9,7 +9,7 @@ data = NULL, show_intercept = FALSE, priors = FALSE, - priors_alpha = 0.4, + alpha_priors = 0.4, n_columns = 1, ... ) @@ -30,7 +30,7 @@ are hardly visible.} (using \code{\link[bayestestR:simulate_prior]{bayestestR::simulate_prior()}}) and added to the plot.} -\item{priors_alpha}{Numeric value specifying alpha for the prior +\item{alpha_priors}{Numeric value specifying alpha for the prior distributions.} \item{n_columns}{For models with multiple components (like fixed and random, diff --git a/man/plot.see_p_function.Rd b/man/plot.see_p_function.Rd index bf5cb909c..b4592d77a 100644 --- a/man/plot.see_p_function.Rd +++ b/man/plot.see_p_function.Rd @@ -8,9 +8,9 @@ x, colors = c("black", "#1b6ca8"), size_point = 1.2, - size_line = c(0.7, 0.9), + linewidth = c(0.7, 0.9), size_text = 3, - line_alpha = 0.15, + alpha_line = 0.15, show_labels = TRUE, n_columns = NULL, show_intercept = FALSE, @@ -26,11 +26,11 @@ are plotted as facets.} \item{size_point}{Numeric specifying size of point-geoms.} -\item{size_line}{Numeric value specifying size of line geoms.} +\item{linewidth}{Numeric value specifying size of line geoms.} \item{size_text}{Numeric value specifying size of text labels.} -\item{line_alpha}{Numeric value specifying alpha of lines indicating the +\item{alpha_line}{Numeric value specifying alpha of lines indicating the emphasized compatibility interval levels (see \code{?parameters::p_function}).} \item{show_labels}{Logical. If \code{TRUE}, text labels are displayed.} diff --git a/man/plot.see_p_significance.Rd b/man/plot.see_p_significance.Rd index d9bb4440d..67e9d654b 100644 --- a/man/plot.see_p_significance.Rd +++ b/man/plot.see_p_significance.Rd @@ -9,7 +9,7 @@ data = NULL, show_intercept = FALSE, priors = FALSE, - priors_alpha = 0.4, + alpha_priors = 0.4, n_columns = 1, ... ) @@ -30,7 +30,7 @@ are hardly visible.} (using \code{\link[bayestestR:simulate_prior]{bayestestR::simulate_prior()}}) and added to the plot.} -\item{priors_alpha}{Numeric value specifying alpha for the prior +\item{alpha_priors}{Numeric value specifying alpha for the prior distributions.} \item{n_columns}{For models with multiple components (like fixed and random, diff --git a/man/plot.see_parameters_brms_meta.Rd b/man/plot.see_parameters_brms_meta.Rd index e2674e129..15da5cb49 100644 --- a/man/plot.see_parameters_brms_meta.Rd +++ b/man/plot.see_parameters_brms_meta.Rd @@ -7,11 +7,11 @@ \method{plot}{see_parameters_brms_meta}( x, size_point = 2, - size_line = 0.8, + linewidth = 0.8, size_text = 3.5, - posteriors_alpha = 0.7, - rope_alpha = 0.15, - rope_color = "cadetblue", + alpha_posteriors = 0.7, + alpha_rope = 0.15, + color_rope = "cadetblue", normalize_height = TRUE, show_labels = TRUE, ... @@ -22,16 +22,16 @@ \item{size_point}{Numeric specifying size of point-geoms.} -\item{size_line}{Numeric value specifying size of line geoms.} +\item{linewidth}{Numeric value specifying size of line geoms.} \item{size_text}{Numeric value specifying size of text labels.} -\item{posteriors_alpha}{Numeric value specifying alpha for the posterior +\item{alpha_posteriors}{Numeric value specifying alpha for the posterior distributions.} -\item{rope_alpha}{Numeric specifying transparency level of ROPE ribbon.} +\item{alpha_rope}{Numeric specifying transparency level of ROPE ribbon.} -\item{rope_color}{Character specifying color of ROPE ribbon.} +\item{color_rope}{Character specifying color of ROPE ribbon.} \item{normalize_height}{Logical. If \code{TRUE}, height of mcmc-areas is "normalized", to avoid overlap. In certain cases when the range of a diff --git a/man/plot.see_parameters_distribution.Rd b/man/plot.see_parameters_distribution.Rd index c42a6db88..693f944c9 100644 --- a/man/plot.see_parameters_distribution.Rd +++ b/man/plot.see_parameters_distribution.Rd @@ -7,12 +7,12 @@ \method{plot}{see_parameters_distribution}( x, dispersion = FALSE, - dispersion_alpha = 0.3, - dispersion_color = "#3498db", + alpha_dispersion = 0.3, + color_dispersion = "#3498db", dispersion_style = c("ribbon", "curve"), size_bar = 0.7, highlight = NULL, - highlight_color = NULL, + color_highlight = NULL, ... ) } @@ -22,9 +22,9 @@ \item{dispersion}{Logical. If \code{TRUE}, a range of dispersion for each variable to the plot will be added.} -\item{dispersion_alpha}{Numeric value specifying the transparency level of dispersion ribbon.} +\item{alpha_dispersion}{Numeric value specifying the transparency level of dispersion ribbon.} -\item{dispersion_color}{Character specifying the color of dispersion ribbon.} +\item{color_dispersion}{Character specifying the color of dispersion ribbon.} \item{dispersion_style}{Character describing the style of dispersion area. \code{"ribbon"} for a ribbon, \code{"curve"} for a normal-curve.} @@ -34,7 +34,7 @@ each variable to the plot will be added.} \item{highlight}{A vector with names of categories in \code{x} that should be highlighted.} -\item{highlight_color}{A vector of color values for highlighted categories. +\item{color_highlight}{A vector of color values for highlighted categories. The remaining (non-highlighted) categories will be filled with a lighter grey.} diff --git a/man/plot.see_parameters_pca.Rd b/man/plot.see_parameters_pca.Rd index c0756c23f..f418f5cb5 100644 --- a/man/plot.see_parameters_pca.Rd +++ b/man/plot.see_parameters_pca.Rd @@ -8,7 +8,7 @@ x, type = c("bar", "line"), size_text = 3.5, - text_color = "black", + color_text = "black", size = 1, show_labels = TRUE, ... @@ -24,7 +24,7 @@ Options are three different shapes to represent component loadings; \item{size_text}{Numeric value specifying size of text labels.} -\item{text_color}{Character specifying color of text labels.} +\item{color_text}{Character specifying color of text labels.} \item{size}{Depending on \code{type}, a numeric value specifying size of bars, lines, or segments.} diff --git a/man/plot.see_parameters_simulate.Rd b/man/plot.see_parameters_simulate.Rd index ab348bb5c..8c7b6ddc5 100644 --- a/man/plot.see_parameters_simulate.Rd +++ b/man/plot.see_parameters_simulate.Rd @@ -11,8 +11,8 @@ show_intercept = FALSE, n_columns = NULL, normalize_height = FALSE, - size_line = 0.9, - posteriors_alpha = 0.7, + linewidth = 0.9, + alpha_posteriors = 0.7, centrality = "median", ci = 0.95, ... @@ -43,9 +43,9 @@ distribution of simulated draws is narrow for some parameters, this may result in very flat density-areas. In such cases, set \code{normalize_height = FALSE}.} -\item{size_line}{Numeric value specifying size of line geoms.} +\item{linewidth}{Numeric value specifying size of line geoms.} -\item{posteriors_alpha}{Numeric value specifying alpha for the posterior +\item{alpha_posteriors}{Numeric value specifying alpha for the posterior distributions.} \item{centrality}{Character specifying the point-estimate (centrality index) diff --git a/man/plot.see_performance_simres.Rd b/man/plot.see_performance_simres.Rd index 8457c3a5d..b96e4e92e 100644 --- a/man/plot.see_performance_simres.Rd +++ b/man/plot.see_performance_simres.Rd @@ -6,13 +6,13 @@ \usage{ \method{plot}{see_performance_simres}( x, - size_line = 0.8, + linewidth = 0.8, size_point = 2, size_title = 12, size_axis_title = base_size, base_size = 10, alpha = 0.2, - dot_alpha = 0.8, + alpha_dot = 0.8, colors = c("#3aaf85", "#1b6ca8"), detrend = FALSE, transform = NULL, @@ -23,7 +23,7 @@ \arguments{ \item{x}{An object.} -\item{size_line}{Numeric value specifying size of line geoms.} +\item{linewidth}{Numeric value specifying size of line geoms.} \item{size_point}{Numeric specifying size of point-geoms.} @@ -32,7 +32,7 @@ axis and plot titles.} \item{alpha}{Numeric value specifying alpha level of the confidence bands.} -\item{dot_alpha}{Numeric value specifying alpha level of the point geoms.} +\item{alpha_dot}{Numeric value specifying alpha level of the point geoms.} \item{colors}{Character vector of length two, indicating the colors (in hex-format) for points and line.} diff --git a/man/plot.see_point_estimate.Rd b/man/plot.see_point_estimate.Rd index d6ea11a64..c1d3204cf 100644 --- a/man/plot.see_point_estimate.Rd +++ b/man/plot.see_point_estimate.Rd @@ -13,7 +13,7 @@ show_labels = TRUE, show_intercept = FALSE, priors = FALSE, - priors_alpha = 0.4, + alpha_priors = 0.4, ... ) } @@ -45,7 +45,7 @@ are hardly visible.} (using \code{\link[bayestestR:simulate_prior]{bayestestR::simulate_prior()}}) and added to the plot.} -\item{priors_alpha}{Numeric value specifying alpha for the prior +\item{alpha_priors}{Numeric value specifying alpha for the prior distributions.} \item{...}{Arguments passed to or from other methods.} diff --git a/man/plot.see_rope.Rd b/man/plot.see_rope.Rd index e38bb418c..ff5c305ab 100644 --- a/man/plot.see_rope.Rd +++ b/man/plot.see_rope.Rd @@ -7,8 +7,8 @@ \method{plot}{see_rope}( x, data = NULL, - rope_alpha = 0.5, - rope_color = "cadetblue", + alpha_rope = 0.5, + color_rope = "cadetblue", show_intercept = FALSE, n_columns = 1, ... @@ -20,9 +20,9 @@ \item{data}{The original data used to create this object. Can be a statistical model.} -\item{rope_alpha}{Numeric specifying transparency level of ROPE ribbon.} +\item{alpha_rope}{Numeric specifying transparency level of ROPE ribbon.} -\item{rope_color}{Character specifying color of ROPE ribbon.} +\item{color_rope}{Character specifying color of ROPE ribbon.} \item{show_intercept}{Logical, if \code{TRUE}, the intercept-parameter is included in the plot. By default, it is hidden because in many cases the diff --git a/man/plot.see_si.Rd b/man/plot.see_si.Rd index 7ea480514..fe95a25ea 100644 --- a/man/plot.see_si.Rd +++ b/man/plot.see_si.Rd @@ -6,8 +6,8 @@ \usage{ \method{plot}{see_si}( x, - si_color = "#0171D3", - si_alpha = 0.2, + color_si = "#0171D3", + alpha_si = 0.2, show_intercept = FALSE, support_only = FALSE, ... @@ -16,9 +16,9 @@ \arguments{ \item{x}{An object.} -\item{si_color}{Character specifying color of SI ribbon.} +\item{color_si}{Character specifying color of SI ribbon.} -\item{si_alpha}{Numeric value specifying Transparency level of SI ribbon.} +\item{alpha_si}{Numeric value specifying Transparency level of SI ribbon.} \item{show_intercept}{Logical, if \code{TRUE}, the intercept-parameter is included in the plot. By default, it is hidden because in many cases the diff --git a/man/print.see_performance_pp_check.Rd b/man/print.see_performance_pp_check.Rd index 7e3d88349..0d6fc9096 100644 --- a/man/print.see_performance_pp_check.Rd +++ b/man/print.see_performance_pp_check.Rd @@ -7,13 +7,13 @@ \usage{ \method{print}{see_performance_pp_check}( x, - size_line = 0.5, + linewidth = 0.5, size_point = 2, size_bar = 0.7, size_axis_title = base_size, size_title = 12, base_size = 10, - line_alpha = 0.15, + alpha_line = 0.15, style = theme_lucid, colors = unname(social_colors(c("green", "blue"))), type = c("density", "discrete_dots", "discrete_interval", "discrete_both"), @@ -23,13 +23,13 @@ \method{plot}{see_performance_pp_check}( x, - size_line = 0.5, + linewidth = 0.5, size_point = 2, size_bar = 0.7, size_axis_title = base_size, size_title = 12, base_size = 10, - line_alpha = 0.15, + alpha_line = 0.15, style = theme_lucid, colors = unname(social_colors(c("green", "blue"))), type = c("density", "discrete_dots", "discrete_interval", "discrete_both"), @@ -40,7 +40,7 @@ \arguments{ \item{x}{An object.} -\item{size_line}{Numeric value specifying size of line geoms.} +\item{linewidth}{Numeric value specifying size of line geoms.} \item{size_point}{Numeric specifying size of point-geoms.} @@ -49,7 +49,7 @@ \item{base_size, size_axis_title, size_title}{Numeric value specifying size of axis and plot titles.} -\item{line_alpha}{Numeric value specifying alpha of lines indicating \code{yrep}.} +\item{alpha_line}{Numeric value specifying alpha of lines indicating \code{yrep}.} \item{style}{A ggplot2-theme.} diff --git a/tests/testthat/test-plot.check_dag.R b/tests/testthat/test-plot.check_dag.R index 2c1a79f41..ec39f88b9 100644 --- a/tests/testthat/test-plot.check_dag.R +++ b/tests/testthat/test-plot.check_dag.R @@ -1,4 +1,3 @@ -skip_if_not_installed("vdiffr") skip_if_not_installed("ggdag") skip_if_not_installed("dagitty") diff --git a/tests/testthat/test-plot.compare_parameters.R b/tests/testthat/test-plot.compare_parameters.R index 586540b43..8824a41a0 100644 --- a/tests/testthat/test-plot.compare_parameters.R +++ b/tests/testthat/test-plot.compare_parameters.R @@ -16,7 +16,7 @@ test_that("`plot()` for compare_parameters", { cp <- parameters::compare_parameters(gmod_glmer, gmod_glmmTMB, effects = "random") expect_warning(plot(cp), "No data left") - skip_if_not_installed("vdiffr") + vdiffr::expect_doppelganger( title = "plot.compare_parameters works", fig = plot(cp, show_intercept = TRUE) diff --git a/tests/testthat/test-plot.describe_distribution.R b/tests/testthat/test-plot.describe_distribution.R index 900246509..579215f7f 100644 --- a/tests/testthat/test-plot.describe_distribution.R +++ b/tests/testthat/test-plot.describe_distribution.R @@ -1,6 +1,6 @@ test_that("`plot.see_parameters_distribution()` works", { set.seed(333) - x <- sample(1:100, 1000, replace = TRUE) + x <- sample.int(100, 1000, replace = TRUE) result <- datawizard::describe_distribution(x) expect_s3_class(plot(result), "gg") diff --git a/tests/testthat/test-plot.p_direction.R b/tests/testthat/test-plot.p_direction.R index 7baf39def..1b6f7e58d 100644 --- a/tests/testthat/test-plot.p_direction.R +++ b/tests/testthat/test-plot.p_direction.R @@ -12,8 +12,9 @@ skip_on_cran() skip_if_not_installed("bayestestR", minimum_version = "0.14.1") skip_if_not_installed("parameters", minimum_version = "0.22.3") -test_that("`plot.see_p_direction works {parameters}}", { - skip_if_not_installed("vdiffr") +test_that("`plot.see_p_direction` works {parameters}", { + skip_if_not_installed("ggridges") + data(qol_cancer, package = "parameters") model <- lm(QoL ~ time + age + education, data = qol_cancer) set.seed(123) @@ -32,6 +33,8 @@ test_that("`plot.see_p_direction works {parameters}}", { test_that("plot p_direction, glmmTMB", { skip_if_not_installed("glmmTMB") + skip_if_not_installed("ggridges") + data(Salamanders, package = "glmmTMB") m1 <- glmmTMB::glmmTMB(count ~ mined + cover + (1 | site), zi = ~mined, diff --git a/tests/testthat/test-plot.p_significance.R b/tests/testthat/test-plot.p_significance.R index fcf981658..1bab2babd 100644 --- a/tests/testthat/test-plot.p_significance.R +++ b/tests/testthat/test-plot.p_significance.R @@ -13,7 +13,8 @@ skip_if_not_installed("bayestestR", minimum_version = "0.14.1") skip_if_not_installed("parameters", minimum_version = "0.22.3") test_that("`plot.see_p_significance works for two thresholds", { - skip_if_not_installed("vdiffr") + skip_if_not_installed("ggridges") + set.seed(123) x <- rnorm(1000, 1, 1.2) out <- bayestestR::p_significance(x) @@ -29,7 +30,8 @@ test_that("`plot.see_p_significance works for two thresholds", { }) test_that("`plot.see_p_significance works {parameters}}", { - skip_if_not_installed("vdiffr") + skip_if_not_installed("ggridges") + data(qol_cancer, package = "parameters") model <- lm(QoL ~ time + age + education, data = qol_cancer) set.seed(123) @@ -54,6 +56,8 @@ test_that("`plot.see_p_significance works {parameters}}", { test_that("plot p_significance, glmmTMB", { skip_if_not_installed("glmmTMB") + skip_if_not_installed("ggridges") + data(Salamanders, package = "glmmTMB") m1 <- glmmTMB::glmmTMB(count ~ mined + cover + (1 | site), zi = ~mined, diff --git a/tests/testthat/test-plot.parameters_model.R b/tests/testthat/test-plot.parameters_model.R index e7e368065..96163d234 100644 --- a/tests/testthat/test-plot.parameters_model.R +++ b/tests/testthat/test-plot.parameters_model.R @@ -3,7 +3,7 @@ test_that("`plot.see_parameters_model()` works", { result <- parameters::model_parameters(m) expect_s3_class(plot(result), "gg") - skip_if_not_installed("vdiffr") + vdiffr::expect_doppelganger( title = "plot.model_parameters_1", fig = plot(result) @@ -15,7 +15,6 @@ test_that("`plot.see_parameters_model()` works", { }) test_that("`plot.see_parameters_model()` random parameters works", { - skip_if_not_installed("vdiffr") skip_if_not_installed("lme4") skip_if_not_installed("parameters") @@ -67,7 +66,6 @@ test_that("`plot.see_parameters_model()` random parameters works", { test_that("`plot.see_parameters_model()` random parameters works", { - skip_if_not_installed("vdiffr") skip_if_not_installed("lme4") skip_if_not_installed("parameters") data(sleepstudy, package = "lme4") @@ -87,7 +85,6 @@ test_that("`plot.see_parameters_model()` random parameters works", { test_that("`plot.see_parameters_model()` random parameters works", { - skip_if_not_installed("vdiffr") skip_if_not_installed("mgcv") skip_if_not_installed("parameters") diff --git a/tests/testthat/test-plot.simulate_parameters.R b/tests/testthat/test-plot.simulate_parameters.R index f292ffa54..5c547ede0 100644 --- a/tests/testthat/test-plot.simulate_parameters.R +++ b/tests/testthat/test-plot.simulate_parameters.R @@ -6,7 +6,7 @@ skip_on_cran() skip_if_offline() skip_if_not_installed("mclogit") skip_if_not_installed("parameters") -skip_if_not_installed("vdiffr") + test_that("`plot()` for simulate_parameters", { pict <- base::readRDS(url("https://slcladal.github.io/data/pict.rda", "rb"))