Skip to content

Commit

Permalink
give informative error for invald input
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Sep 6, 2024
1 parent e9b0b48 commit 9cf8d77
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: see
Title: Model Visualisation Toolbox for 'easystats' and 'ggplot2'
Version: 0.9.0
Version: 0.9.0.1
Authors@R:
c(person(given = "Daniel",
family = "Lüdecke",
Expand Down
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# see (development)

## Changes

- `plot()` for `p_function()` now checks the values of the `size_length`
argument, to give an informative error message when the input is not valid.

# see 0.9.0

## Changes
Expand Down
6 changes: 6 additions & 0 deletions R/plot.p_function.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ 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
# 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
}

# setup - no color/fill aes for ribbons when we have no facets
if (!is.null(n_columns) || insight::n_unique(data_ribbon$Parameter) == 1) {
p <- ggplot2::ggplot() +
Expand Down
2 changes: 1 addition & 1 deletion vignettes/parameters.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ result <- p_function(model)
plot(result)
result <- p_function(model, ci_levels = c(0.5, 0.7, emph = 0.9))
plot(result, size_line = 0.6, 1.0)
plot(result, size_line = c(0.6, 1.2))
```

## Principal Component Analysis
Expand Down

0 comments on commit 9cf8d77

Please sign in to comment.