From 0bc05bf366bb08cd7348e41eb42b2015cc029b58 Mon Sep 17 00:00:00 2001 From: nfrerebeau Date: Thu, 27 Jun 2024 16:50:29 +0200 Subject: [PATCH] Change default color schemes --- R/palettes.R | 4 ++-- inst/tinytest/test_palettes.R | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/R/palettes.R b/R/palettes.R index f737577..bd88098 100644 --- a/R/palettes.R +++ b/R/palettes.R @@ -99,7 +99,7 @@ palette_color_continuous <- function(colors = NULL, domain = NULL, OK <- !is.na(x) if (is.null(colors)) { - colors <- grDevices::hcl.colors(12, "YlOrRd", rev = TRUE) + colors <- color(palette = "YlOrBr")(9) } colors <- grDevices::colorRamp(colors)(x[OK], ...) @@ -152,7 +152,7 @@ palette_color_discrete <- function(colors = NULL, domain = NULL, OK <- !is.na(x) if (is.null(colors)) { - colors <- grDevices::hcl.colors(n, "viridis") + colors <- color(palette = "discreterainbow")(n) } if (length(colors) < n) { diff --git a/inst/tinytest/test_palettes.R b/inst/tinytest/test_palettes.R index a3cf7a2..bdba618 100644 --- a/inst/tinytest/test_palettes.R +++ b/inst/tinytest/test_palettes.R @@ -37,7 +37,7 @@ expect_warning(palette_color_picker(scheme = "bright")(c(1, 2, 3, 4, 5, 6, 7))) ## Continuous ------------------------------------------------------------------ expect_identical( palette_color_continuous()(c(1, 2, 3)), - c("#FFFFC8", "#F39200", "#7D0025") + c("#FFFFE5", "#FB9A29", "#662506") ) expect_identical( palette_color_continuous(bw)(c(0, 0.5, 1)), @@ -70,8 +70,8 @@ expect_identical( ## Discrete -------------------------------------------------------------------- expect_identical( - palette_color_discrete(NULL, LETTERS)(lvl), - c("#4B0055", "#4B0055", "#462169", "#4A0E5F", "#4B0055", "#4A0E5F") + palette_color_discrete(NULL, domain = LETTERS[1:23])(lvl), + c("#E8ECFB", "#E8ECFB", "#CAACCB", "#D9CCE3", "#E8ECFB", "#D9CCE3") ) expect_identical( palette_color_discrete(c("#4477AA", "#EE6677", "#228833"), domain = c("A", "B", "C"))(lvl),