Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Harmonize API #373

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions R/plot.bayesfactor_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)) {
Expand Down Expand Up @@ -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 +
Expand Down
8 changes: 4 additions & 4 deletions R/plot.binned_residuals.R
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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
)
}

Expand All @@ -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 {
Expand All @@ -101,7 +101,7 @@ plot.see_binned_residuals <- function(x,
ymax = .data$CI_high,
colour = .data$group
),
linewidth = size_line,
linewidth = linewidth,
width = 0
)
}
Expand Down
8 changes: 4 additions & 4 deletions R/plot.check_collinearity.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions R/plot.check_heteroscedasticity.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#'
#' @return A ggplot2-object.
#'
#' @seealso See also the vignette about [`check_model()`](https://easystats.github.io/performance/articles/check_model.html).

Check warning on line 11 in R/plot.check_heteroscedasticity.R

View workflow job for this annotation

GitHub Actions / lint / lint

file=R/plot.check_heteroscedasticity.R,line=11,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 125 characters.

Check warning on line 11 in R/plot.check_heteroscedasticity.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/plot.check_heteroscedasticity.R,line=11,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 125 characters.
#'
#' @examples
#' m <- lm(mpg ~ wt + cyl + gear + disp, data = mtcars)
Expand All @@ -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,
Expand Down Expand Up @@ -79,7 +79,7 @@
.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,
Expand Down
8 changes: 4 additions & 4 deletions R/plot.check_homogeneity.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand All @@ -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
)
}

Expand All @@ -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(
Expand Down
48 changes: 24 additions & 24 deletions R/plot.check_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#'
#' @return A ggplot2-object.
#'
#' @seealso See also the vignette about [`check_model()`](https://easystats.github.io/performance/articles/check_model.html).

Check warning on line 12 in R/plot.check_model.R

View workflow job for this annotation

GitHub Actions / lint / lint

file=R/plot.check_model.R,line=12,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 125 characters.

Check warning on line 12 in R/plot.check_model.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/plot.check_model.R,line=12,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 125 characters.
#'
#' @examplesIf require("patchwork")
#' library(performance)
Expand All @@ -18,7 +18,7 @@
#' plot(check_model(model))
#'
#' @export
plot.see_check_model <- function(x,

Check warning on line 21 in R/plot.check_model.R

View workflow job for this annotation

GitHub Actions / lint / lint

file=R/plot.check_model.R,line=21,col=1,[cyclocomp_linter] Reduce the cyclomatic complexity of this function from 82 to at most 40.

Check warning on line 21 in R/plot.check_model.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/plot.check_model.R,line=21,col=1,[cyclocomp_linter] Reduce the cyclomatic complexity of this function from 82 to at most 40.
style = theme_lucid,
colors = NULL,
type = c("density", "discrete_dots", "discrete_interval", "discrete_both"),
Expand All @@ -31,14 +31,14 @@
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")
Expand All @@ -46,7 +46,7 @@
plot_type <- attr(x, "type")
model_class <- attr(x, "model_class")

if (missing(type) && !is.null(plot_type) && plot_type %in% c("density", "discrete_dots", "discrete_interval", "discrete_both")) {

Check warning on line 49 in R/plot.check_model.R

View workflow job for this annotation

GitHub Actions / lint / lint

file=R/plot.check_model.R,line=49,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 131 characters.

Check warning on line 49 in R/plot.check_model.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/plot.check_model.R,line=49,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 131 characters.
type <- plot_type
} else {
type <- match.arg(type)
Expand All @@ -73,8 +73,8 @@
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)) {
Expand All @@ -101,7 +101,7 @@
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,
Expand All @@ -117,14 +117,14 @@
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
)
}
Expand Down Expand Up @@ -152,7 +152,7 @@
size_axis_title = size_axis_title,
size_title = size_title,
colors = colors[c(1, 2)],
size_line = size_line,
linewidth = linewidth,
type = overdisp_type
)
}
Expand All @@ -161,14 +161,14 @@
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
)
}
Expand All @@ -178,14 +178,14 @@
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
)
}
Expand All @@ -194,7 +194,7 @@
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,
Expand All @@ -209,10 +209,10 @@
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,
Expand All @@ -224,15 +224,15 @@
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,
detrend = detrend,
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
Expand All @@ -243,7 +243,7 @@
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,
Expand All @@ -257,14 +257,14 @@
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
)

Expand All @@ -285,14 +285,14 @@

.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))

Expand All @@ -301,7 +301,7 @@
geom_point2(
colour = colors[2],
size = size_point,
alpha = dot_alpha_level
alpha = alpha_dot
)
}

Expand All @@ -311,7 +311,7 @@
se = TRUE,
formula = y ~ x,
alpha = alpha_level,
linewidth = size_line,
linewidth = linewidth,
colour = colors[1]
) +
ggplot2::geom_hline(yintercept = 0, linetype = "dashed") +
Expand Down
Loading
Loading