diff --git a/DESCRIPTION b/DESCRIPTION index 14684c70f..4ffccd9ea 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: see Title: Model Visualisation Toolbox for 'easystats' and 'ggplot2' -Version: 0.8.3.5 +Version: 0.8.3.6 Authors@R: c(person(given = "Daniel", family = "Lüdecke", diff --git a/NEWS.md b/NEWS.md index 565575a7e..e6b1fa880 100644 --- a/NEWS.md +++ b/NEWS.md @@ -11,6 +11,10 @@ * `plot()` for `check_predictions()` now supports Bayesian regression models from *brms* and *rstanarm*. +## Bug fixes + +* Corrected order of models for `plot.compare_parameters()`. + # see 0.8.3 ## Major changes diff --git a/R/plot.compare_parameters.R b/R/plot.compare_parameters.R index 0e4ca892e..56659ebb6 100644 --- a/R/plot.compare_parameters.R +++ b/R/plot.compare_parameters.R @@ -75,9 +75,13 @@ plot.see_compare_parameters <- function(x, x$Component <- factor(x$Component, levels = unique(x$Component)) } - + # show/hide intercepts if (!show_intercept) { x <- x[!.is_intercept(x$Parameter), ] + # sanity check - any data left? + if (nrow(x) == 0) { + insight::format_warning("No data left after removing intercepts. Returning empty plot.") + } } if (isTRUE(sort) || (!is.null(sort) && sort == "ascending")) { @@ -224,6 +228,8 @@ data_plot.see_compare_parameters <- function(x, ...) { } dataplot$group <- gsub("(.*)\\.(.*)", "\\2", dataplot$group) + # make factor, so order in legend is preserved + dataplot$group <- factor(dataplot$group, levels = unique(dataplot$group)) rownames(dataplot) <- NULL