From 52cc4e9572be80626bc67ac9ac28201221dba802 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 14 Sep 2023 08:35:26 +0200 Subject: [PATCH] don't show smooth line by default, it fails too often --- DESCRIPTION | 2 +- NEWS.md | 2 ++ R/plot.binned_residuals.R | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 8c8add489..685bf439d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: see Title: Model Visualisation Toolbox for 'easystats' and 'ggplot2' -Version: 0.8.0.3 +Version: 0.8.0.4 Authors@R: c(person(given = "Daniel", family = "Lüdecke", diff --git a/NEWS.md b/NEWS.md index 124760e61..e118c6a1e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -14,6 +14,8 @@ `method = "pointwise"`. * Plot method for `performance::check_normality()` now default to a detrended QQ-plot. Previous behavior can be restored by setting `type = "density"`. +* Plot method for `binned_residuals()` gains a `show_smooth` argument, to show + or hide the smooth line. # see 0.8.0 diff --git a/R/plot.binned_residuals.R b/R/plot.binned_residuals.R index 1cbfb5329..6ec460caa 100644 --- a/R/plot.binned_residuals.R +++ b/R/plot.binned_residuals.R @@ -4,6 +4,7 @@ plot.see_binned_residuals <- function(x, size_line = 0.7, size_point = 2.2, colors = social_colors(c("blue", "red", "green")), + show_smooth = FALSE, style = theme_lucid, ...) { x$se.lo <- -x$se @@ -44,7 +45,7 @@ plot.see_binned_residuals <- function(x, p <- ggplot2::ggplot(data = x, ggplot2::aes(x = .data$xbar)) + ggplot2::geom_abline(slope = 0, intercept = 0, colour = "grey80") - if (isTRUE(insight::check_if_installed("mgcv", quietly = TRUE))) { + if (isTRUE(insight::check_if_installed("mgcv", quietly = TRUE)) && show_smooth) { p <- p + ggplot2::stat_smooth( ggplot2::aes(y = .data$ybar),