Skip to content

Commit

Permalink
CRAN release 0.7.5 (#271)
Browse files Browse the repository at this point in the history
* Update DESCRIPTION

* avoid circular devel version dependency

* suppress package startups

* fix example

* minor

* use fornat_alerts

* line length lints

* bump insight

* run tests in parallel

* avoid generic names

* Create check-random-test-order.yaml

* fix tests

* add a global skip for tests

* extract out commonly used model

* bump version

---------

Co-authored-by: Daniel <[email protected]>
  • Loading branch information
IndrajeetPatil and strengejacke authored Mar 23, 2023
1 parent 1abb493 commit bb6e71e
Show file tree
Hide file tree
Showing 37 changed files with 255 additions and 113 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/check-random-test-order.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Run tests in random order
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: check-random-test-order

jobs:
check-random-test-order:
uses: easystats/workflows/.github/workflows/check-random-test-order.yaml@main
22 changes: 9 additions & 13 deletions 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.7.4.3
Version: 0.7.5
Authors@R:
c(person(given = "Daniel",
family = "Lüdecke",
Expand Down Expand Up @@ -63,20 +63,15 @@ Depends:
R (>= 3.6),
stats
Imports:
bayestestR (>= 0.13.0.6),
correlation (>= 0.8.3.1),
datawizard (>= 0.6.4),
bayestestR (>= 0.13.0),
correlation (>= 0.8.3),
datawizard (>= 0.7.0),
effectsize (>= 0.8.3),
ggplot2 (>= 3.4.0),
insight (>= 0.19.0),
ggplot2 (>= 3.4.1),
insight (>= 0.19.1),
modelbased (>= 0.8.5),
parameters (>= 0.20.0),
parameters (>= 0.20.2),
performance (>= 0.10.1)
Remotes:
easystats/insight,
easystats/parameters,
easystats/correlation,
easystats/bayestestR
Suggests:
brms,
curl,
Expand Down Expand Up @@ -109,14 +104,15 @@ Suggests:
rstanarm,
scales (>= 1.2.1),
splines,
testthat (>= 3.1.6),
testthat (>= 3.1.7),
tidygraph,
vdiffr (>= 1.0.5)
Encoding: UTF-8
Language: en-US
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3.9000
Config/testthat/edition: 3
Config/testthat/parallel: true
Config/Needs/website:
rstudio/bslib,
r-lib/pkgdown,
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# see (development version)
# see 0.7.5

## Changes

Expand Down
5 changes: 3 additions & 2 deletions R/plot.hdi.R
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ data_plot.bayestestR_eti <- data_plot.hdi

# normalize
out$height <- as.vector((out$height - min(out$height, na.rm = TRUE)) / diff(range(out$height, na.rm = TRUE), na.rm = TRUE))

out
}

Expand Down Expand Up @@ -215,8 +216,8 @@ plot.see_hdi <- function(x,
}

# check if we have multiple panels
if ((!"Effects" %in% names(x) || length(unique(x$Effects)) <= 1) &&
(!"Component" %in% names(x) || length(unique(x$Component)) <= 1)) {
if ((!"Effects" %in% names(x) || length(unique(x$Effects)) <= 1L) &&
(!"Component" %in% names(x) || length(unique(x$Component)) <= 1L)) {
n_columns <- NULL
}

Expand Down
2 changes: 1 addition & 1 deletion R/plot.performance_roc.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ plot.see_performance_roc <- function(x, ...) {
x,
aes(
x = .data$Specificity,
y = .data$Sensitivity,
y = .data$Sensitivity
)
)
}
Expand Down
23 changes: 8 additions & 15 deletions R/plots.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#' Multiple plots side by side
#'
#' A wrapper around *patchwork* to plot multiple figures side by side on
#' the same page. See
#' [the
#' *patchwork* documentation](https://patchwork.data-imaginist.com/articles/patchwork.html) for more advanced control of plot layouts.
#' the same page. See [the *patchwork* documentation](https://patchwork.data-imaginist.com/articles/patchwork.html)
#' for more advanced control of plot layouts.
#'
#' @param ... Multiple `ggplot`s or a list containing `ggplot` objects
#' @param n_rows Number of rows to align plots.
Expand Down Expand Up @@ -99,20 +98,14 @@ plots <- function(...,
pw_drawn <- tryCatch(print(pw), error = function(e) e)
if (inherits(pw_drawn, "simpleError")) {
if (Sys.getenv("RSTUDIO") == "1") {
stop(
insight::format_message(
"The RStudio 'Plots' window is too small to show this set of plots.",
"Please make the window larger."
),
call. = FALSE
insight::format_error(
"The RStudio 'Plots' window is too small to show this set of plots.",
"Please make the window larger."
)
} else {
stop(
insight::format_message(
"The viewport is too small to show this set of plots.",
"Please make it larger."
),
call. = FALSE
insight::format_error(
"The viewport is too small to show this set of plots.",
"Please make it larger."
)
}
}
Expand Down
72 changes: 61 additions & 11 deletions R/scale_color_bluebrown.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,34 @@ scale_color_bluebrown <- function(palette = "contrast", discrete = TRUE, reverse

#' @rdname scale_color_bluebrown
#' @export
scale_color_bluebrown_d <- function(palette = "contrast", discrete = TRUE, reverse = FALSE, aesthetics = "color", ...) {
scale_color_bluebrown(palette = palette, discrete = discrete, reverse = reverse, aesthetics = aesthetics, ...)
scale_color_bluebrown_d <- function(palette = "contrast",
discrete = TRUE,
reverse = FALSE,
aesthetics = "color",
...) {
scale_color_bluebrown(
palette = palette,
discrete = discrete,
reverse = reverse,
aesthetics = aesthetics,
...
)
}

#' @rdname scale_color_bluebrown
#' @export
scale_color_bluebrown_c <- function(palette = "contrast", discrete = FALSE, reverse = FALSE, aesthetics = "color", ...) {
scale_color_bluebrown(palette = palette, discrete = discrete, reverse = reverse, aesthetics = aesthetics, ...)
scale_color_bluebrown_c <- function(palette = "contrast",
discrete = FALSE,
reverse = FALSE,
aesthetics = "color",
...) {
scale_color_bluebrown(
palette = palette,
discrete = discrete,
reverse = reverse,
aesthetics = aesthetics,
...
)
}

#' @rdname scale_color_bluebrown
Expand All @@ -65,11 +85,20 @@ scale_colour_bluebrown_d <- scale_color_bluebrown_d

#' @rdname scale_color_bluebrown
#' @export
scale_fill_bluebrown <- function(palette = "contrast", discrete = TRUE, reverse = FALSE, aesthetics = "fill", ...) {
scale_fill_bluebrown <- function(palette = "contrast",
discrete = TRUE,
reverse = FALSE,
aesthetics = "fill",
...) {
pal <- palette_bluebrown(palette = palette, reverse = reverse)

if (discrete) {
discrete_scale(aesthetics = aesthetics, paste0("bluebrown_", palette), palette = pal, ...)
discrete_scale(
aesthetics = aesthetics,
paste0("bluebrown_", palette),
palette = pal,
...
)
} else {
scale_fill_gradientn(colours = pal(256), aesthetics = aesthetics, ...)
}
Expand All @@ -78,14 +107,34 @@ scale_fill_bluebrown <- function(palette = "contrast", discrete = TRUE, reverse

#' @rdname scale_color_bluebrown
#' @export
scale_fill_bluebrown_d <- function(palette = "contrast", discrete = TRUE, reverse = FALSE, aesthetics = "fill", ...) {
scale_fill_bluebrown(palette = palette, discrete = discrete, reverse = reverse, aesthetics = aesthetics, ...)
scale_fill_bluebrown_d <- function(palette = "contrast",
discrete = TRUE,
reverse = FALSE,
aesthetics = "fill",
...) {
scale_fill_bluebrown(
palette = palette,
discrete = discrete,
reverse = reverse,
aesthetics = aesthetics,
...
)
}

#' @rdname scale_color_bluebrown
#' @export
scale_fill_bluebrown_c <- function(palette = "contrast", discrete = FALSE, reverse = FALSE, aesthetics = "fill", ...) {
scale_fill_bluebrown(palette = palette, discrete = discrete, reverse = reverse, aesthetics = aesthetics, ...)
scale_fill_bluebrown_c <- function(palette = "contrast",
discrete = FALSE,
reverse = FALSE,
aesthetics = "fill",
...) {
scale_fill_bluebrown(
palette = palette,
discrete = discrete,
reverse = reverse,
aesthetics = aesthetics,
...
)
}


Expand All @@ -110,7 +159,8 @@ bluebrown_colors_list <- c(

#' Extract blue-brown colors as hex codes
#'
#' Can be used to get the hex code of specific colors from the blue-brown color palette. Use `bluebrown_colors()` to see all available colors.
#' Can be used to get the hex code of specific colors from the blue-brown color palette.
#' Use `bluebrown_colors()` to see all available colors.
#'
#' @inheritParams flat_colors
#'
Expand Down
27 changes: 25 additions & 2 deletions R/scale_color_material.R
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,33 @@ material_colors <- function(...) {
material_palettes <- list(
`full` = material_colors(),
`ice` = material_colors("purple", "deep purple", "indigo", "blue", "light blue"),
`rainbow` = material_colors("purple", "deep purple", "indigo", "blue", "light blue", "green", "light green", "lime", "amber", "orange", "deep orange", "red", "pink"),
`rainbow` = material_colors(
"purple",
"deep purple",
"indigo",
"blue",
"light blue",
"green",
"light green",
"lime",
"amber",
"orange",
"deep orange",
"red",
"pink"
),
`contrast` = material_colors("blue", "green", "amber", "purple", "red"),
`light` = material_colors("light blue", "pink", "yellow", "light green", "orange"),
`complement` = material_colors("blue", "blue grey", "teal", "green", "light green", "yellow", "amber", "red")
`complement` = material_colors(
"blue",
"blue grey",
"teal",
"green",
"light green",
"yellow",
"amber",
"red"
)
)


Expand Down
6 changes: 3 additions & 3 deletions R/scale_color_okabeito.R
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ palette_okabeito <- function(palette = "full_amber", reverse = FALSE, order = 1:
datawizard::text_concatenate(names(okabeito_palettes), last = " or ", enclose = "`"),
"."
), "Using default palette now.")
warning(insight::format_message(msg), call. = FALSE)
insight::format_warning(msg)
palette <- "full"
}

Expand All @@ -219,11 +219,11 @@ palette_okabeito <- function(palette = "full_amber", reverse = FALSE, order = 1:

function(n) {
if (n > length(pal)) {
warning(insight::format_message(
insight::format_warning(
"The number of colors requested `n` is too large.",
paste0("The maximum number of colors is ", length(pal), "."),
paste0("Returning a palette with ", length(pal), " colors.")
))
)
n <- length(pal)
}
unname(pal[seq_len(n)])
Expand Down
27 changes: 24 additions & 3 deletions R/scale_color_see.R
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,30 @@ see_colors <- function(...) {
see_palettes <- list(
`full` = see_colors(),
`ice` = see_colors("indigo", "blue", "blue grey", "cyan", "light blue"),
`rainbow` = see_colors("purple", "deep purple", "indigo", "blue", "light blue", "green", "light green", "lime", "amber", "orange", "red", "pink"),
`rainbow` = see_colors(
"purple",
"deep purple",
"indigo",
"blue",
"light blue",
"green",
"light green",
"lime",
"amber",
"orange",
"red",
"pink"
),
`contrast` = see_colors("blue", "orange", "yellow", "green", "red"),
`complement` = see_colors("blue", "blue grey", "green", "light green", "yellow", "amber", "red"),
`complement` = see_colors(
"blue",
"blue grey",
"green",
"light green",
"yellow",
"amber",
"red"
),
`light` = see_colors("light blue", "pink", "lime", "light green", "orange")
)

Expand Down Expand Up @@ -230,7 +251,7 @@ palette_see <- function(palette = "contrast", reverse = FALSE, ...) {
datawizard::text_concatenate(names(palette_list), last = " or ", enclose = "`"),
"."
), "Using default palette now.")
warning(insight::format_message(msg), call. = FALSE)
insight::format_warning(msg)
palette <- 1
}
pal <- palette_list[[palette]]
Expand Down
25 changes: 23 additions & 2 deletions R/scale_color_social.R
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,31 @@ social_colors <- function(...) {
social_palettes <- list(
`full` = social_colors(),
`ice` = social_colors("purple", "deep purple", "blue", "light blue"),
`rainbow` = social_colors("purple", "deep purple", "blue", "light blue", "green", "light green", "amber", "orange", "deep orange", "red"),
`rainbow` = social_colors(
"purple",
"deep purple",
"blue",
"light blue",
"green",
"light green",
"amber",
"orange",
"deep orange",
"red"
),
`contrast` = social_colors("blue", "green", "amber", "purple", "red"),
`light` = material_colors("light blue", "purple", "yellow", "light green", "deep orange"),
`complement` = social_colors("blue grey", "blue", "light blue", "teal", "green", "yellow", "amber", "orange", "red")
`complement` = social_colors(
"blue grey",
"blue",
"light blue",
"teal",
"green",
"yellow",
"amber",
"orange",
"red"
)
)


Expand Down
Loading

0 comments on commit bb6e71e

Please sign in to comment.