diff --git a/NEWS.md b/NEWS.md index 425100c..99a9272 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,9 @@ ## New functions * Add Paul Tol `nightfall` and `incandescent` colour schemes. +## Bugfixes & changes +* Fix `discreterainbow` scheme (qualitative scheme instead of sequential). + # khroma 1.11.0 ## Bugfixes & changes * Fix `ramp()` to return a palette function with argument a vector of values that are mapped to colors. diff --git a/R/color.R b/R/color.R index 6e51d82..7798df2 100644 --- a/R/color.R +++ b/R/color.R @@ -161,15 +161,17 @@ colour <- function(palette, reverse = FALSE, names = TRUE, lang = "en", fun <- function(n, range = c(0, 1)) { if (missing(n)) n <- k # Validate - if (n > k) - stop( - sprintf("%s color scheme supports up to %d values.", - sQuote(palette), k), - call. = FALSE - ) + if (n > k) { + msg <- "%s color scheme supports up to %d values." + stop(sprintf(msg, sQuote(palette), k), call. = FALSE) + } # Arrange color schemes if (!is.null(col_scheme)) { m <- col_scheme[[n]] + if (reverse) { + m <- rev(m) + col_colors <- rev(col_colors) + } col <- col_colors[m] } else if (col_type == "qualitative") { m <- seq_len(n) diff --git a/R/scale_colour_tol.R b/R/scale_colour_tol.R index eec8605..bb2665f 100644 --- a/R/scale_colour_tol.R +++ b/R/scale_colour_tol.R @@ -468,6 +468,61 @@ scale_edge_fill_light <- function(..., reverse = FALSE, scale_discrete(aesthetics, "light", reverse = reverse, ...) } +## Discrete Rainbow ------------------------------------------------------------ +#' Paul Tol's *discrete rainbow* Sequential Color Scheme +#' +#' @inheritParams scale_tol_sequential +#' @inheritSection scale_tol_sequential Interpolation +#' @inheritSection colour Rainbow Color Scheme +#' @return A [discrete][ggplot2::discrete_scale] scale. +#' @references +#' Tol, P. (2018). *Colour Schemes*. SRON. Technical Note No. +#' SRON/EPS/TN/09-002, issue 3.1. +#' URL: \url{https://personal.sron.nl/~pault/data/colourschemes.pdf} +#' @example inst/examples/ex-tol-discrete.R +#' @author N. Frerebeau +#' @family qualitative color schemes +#' @family Paul Tol's color schemes +#' @name scale_tol_discreterainbow +#' @rdname scale_tol_discreterainbow +NULL + +#' @export +#' @rdname scale_tol_discreterainbow +scale_colour_discreterainbow <- function(..., reverse = FALSE, + aesthetics = "colour") { + scale_discrete(aesthetics, "discreterainbow", reverse = reverse, ...) +} + +#' @export +#' @rdname scale_tol_discreterainbow +scale_color_discreterainbow <- scale_colour_discreterainbow + +#' @export +#' @rdname scale_tol_discreterainbow +scale_fill_discreterainbow <- function(..., reverse = FALSE, + aesthetics = "fill") { + scale_discrete(aesthetics, "discreterainbow", reverse = reverse, ...) +} + +#' @export +#' @rdname scale_tol_discreterainbow +scale_edge_colour_discreterainbow <- function(..., reverse = FALSE, + aesthetics = "edge_colour") { + scale_discrete(aesthetics, "discreterainbow", reverse = reverse, ...) +} + +#' @export +#' @rdname scale_tol_discreterainbow +scale_edge_color_discreterainbow <- scale_edge_colour_discreterainbow + +#' @export +#' @rdname scale_tol_discreterainbow +scale_edge_fill_discreterainbow <- function(..., reverse = FALSE, + aesthetics = "edge_fill") { + scale_discrete(aesthetics, "discreterainbow", reverse = reverse, ...) +} + # Diverging ==================================================================== #' Paul Tol's Diverging Color Schemes for \pkg{ggplot2} and \pkg{ggraph} #' @@ -1094,61 +1149,6 @@ scale_edge_fill_incandescent <- function(..., reverse = FALSE, range = c(0, 1), } } -## Discrete Rainbow ------------------------------------------------------------ -#' Paul Tol's *discrete rainbow* Sequential Color Scheme -#' -#' @inheritParams scale_tol_sequential -#' @inheritSection scale_tol_sequential Interpolation -#' @inheritSection colour Rainbow Color Scheme -#' @return A [continuous][ggplot2::continuous_scale] scale. -#' @references -#' Tol, P. (2018). *Colour Schemes*. SRON. Technical Note No. -#' SRON/EPS/TN/09-002, issue 3.1. -#' URL: \url{https://personal.sron.nl/~pault/data/colourschemes.pdf} -#' @example inst/examples/ex-tol-sequential.R -#' @author N. Frerebeau -#' @family sequential color schemes -#' @family Paul Tol's color schemes -#' @name scale_tol_discreterainbow -#' @rdname scale_tol_discreterainbow -NULL - -#' @export -#' @rdname scale_tol_discreterainbow -scale_colour_discreterainbow <- function(..., reverse = FALSE, - aesthetics = "colour") { - scale_discrete(aesthetics, "discreterainbow", reverse = reverse, ...) -} - -#' @export -#' @rdname scale_tol_discreterainbow -scale_color_discreterainbow <- scale_colour_discreterainbow - -#' @export -#' @rdname scale_tol_discreterainbow -scale_fill_discreterainbow <- function(..., reverse = FALSE, - aesthetics = "fill") { - scale_discrete(aesthetics, "discreterainbow", reverse = reverse, ...) -} - -#' @export -#' @rdname scale_tol_discreterainbow -scale_edge_colour_discreterainbow <- function(..., reverse = FALSE, - aesthetics = "edge_colour") { - scale_discrete(aesthetics, "discreterainbow", reverse = reverse, ...) -} - -#' @export -#' @rdname scale_tol_discreterainbow -scale_edge_color_discreterainbow <- scale_edge_colour_discreterainbow - -#' @export -#' @rdname scale_tol_discreterainbow -scale_edge_fill_discreterainbow <- function(..., reverse = FALSE, - aesthetics = "edge_fill") { - scale_discrete(aesthetics, "discreterainbow", reverse = reverse, ...) -} - ## Smooth Rainbow -------------------------------------------------------------- #' Paul Tol's *smooth rainbow* Sequential Color Scheme #' diff --git a/R/sysdata.rda b/R/sysdata.rda index caa96e9..1f79f53 100644 Binary files a/R/sysdata.rda and b/R/sysdata.rda differ diff --git a/data-raw/schemes_PaulTol.R b/data-raw/schemes_PaulTol.R index e7a6b69..8ced5e3 100644 --- a/data-raw/schemes_PaulTol.R +++ b/data-raw/schemes_PaulTol.R @@ -115,6 +115,51 @@ schemes_tol2018 <- list( ), scheme = NULL ), + discreterainbow = list( + type = "qualitative", + interpolate = FALSE, + missing = "#777777", + max = 23, + colours = c("#E8ECFB", "#D9CCE3", "#D1BBD7", "#CAACCB", "#BA8DB4", + "#AE76A3", "#AA6F9E", "#994F88", "#882E72", "#1965B0", + "#437DBF", "#5289C7", "#6195CF", "#7BAFDE", "#4EB265", + "#90C987", "#CAE0AB", "#F7F056", "#F7CB45", "#F6C141", + "#F4A736", "#F1932D", "#EE8026", "#E8601C", "#E65518", + "#DC050C", "#A5170E", "#72190E", "#42150A"), + names = list( + en = c("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", + "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", + "21", "22", "23", "24", "25", "26", "27", "28", "29"), + fr = c("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", + "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", + "21", "22", "23", "24", "25", "26", "27", "28", "29") + ), + scheme = list( + c(10), + c(10, 26), + c(10, 18, 26), + c(10, 15, 18, 26), + c(10, 14, 15, 18, 26), + c(10, 14, 15, 17, 18, 26), + c(9, 10, 14, 15, 17, 18, 26), + c(9, 10, 14, 15, 17, 18, 23, 26), + c(9, 10, 14, 15, 17, 18, 23, 26, 28), + c(9, 10, 14, 15, 17, 18, 21, 24, 26, 28), + c(9, 10, 12, 14, 15, 17, 18, 21,24, 26, 28), + c(3, 6, 9, 10, 12, 14, 15, 17, 18, 21, 24, 26), + c(3, 6, 9, 10, 12, 14, 15, 16, 17, 18, 21, 24, 26), + c(3, 6, 9, 10, 12, 14, 15, 16, 17, 18, 20, 22, 24, 26), + c(3, 6, 9, 10, 12, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28), + c(3, 5, 7, 9, 10, 12, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28), + c(3, 5, 7, 8, 9, 10, 12, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28), + c(3, 5, 7, 8, 9, 10, 12, 14, 15, 16, 17, 18, 20, 22, 24, 26, 27, 28), + c(2, 4, 5, 7, 8, 9, 10, 12, 14, 15, 16, 17, 18, 20, 22, 24, 26, 27, 28), + c(2, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 20, 22, 24, 26, 27, 28), + c(2, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 21, 23, 25, 26, 27, 28), + c(2, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 21, 23, 25, 26, 27, 28, 29), + c(1, 2, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 21, 23, 25, 26, 27, 28, 29) + ) + ), # Diverging colour types --------------------------------------------------- # The colours can be used as given or linearly interpolated sunset = list( @@ -192,51 +237,6 @@ schemes_tol2018 <- list( names = NULL, scheme = NULL ), - discreterainbow = list( - type = "sequential", - interpolate = FALSE, - missing = "#777777", - max = 23, - colours = c("#E8ECFB", "#D9CCE3", "#D1BBD7", "#CAACCB", "#BA8DB4", - "#AE76A3", "#AA6F9E", "#994F88", "#882E72", "#1965B0", - "#437DBF", "#5289C7", "#6195CF", "#7BAFDE", "#4EB265", - "#90C987", "#CAE0AB", "#F7F056", "#F7CB45", "#F6C141", - "#F4A736", "#F1932D", "#EE8026", "#E8601C", "#E65518", - "#DC050C", "#A5170E", "#72190E", "#42150A"), - names = list( - en = c("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", - "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", - "21", "22", "23", "24", "25", "26", "27", "28", "29"), - fr = c("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", - "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", - "21", "22", "23", "24", "25", "26", "27", "28", "29") - ), - scheme = list( - c(10), - c(10, 26), - c(10, 18, 26), - c(10, 15, 18, 26), - c(10, 14, 15, 18, 26), - c(10, 14, 15, 17, 18, 26), - c(9, 10, 14, 15, 17, 18, 26), - c(9, 10, 14, 15, 17, 18, 23, 26), - c(9, 10, 14, 15, 17, 18, 23, 26, 28), - c(9, 10, 14, 15, 17, 18, 21, 24, 26, 28), - c(9, 10, 12, 14, 15, 17, 18, 21,24, 26, 28), - c(3, 6, 9, 10, 12, 14, 15, 17, 18, 21, 24, 26), - c(3, 6, 9, 10, 12, 14, 15, 16, 17, 18, 21, 24, 26), - c(3, 6, 9, 10, 12, 14, 15, 16, 17, 18, 20, 22, 24, 26), - c(3, 6, 9, 10, 12, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28), - c(3, 5, 7, 9, 10, 12, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28), - c(3, 5, 7, 8, 9, 10, 12, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28), - c(3, 5, 7, 8, 9, 10, 12, 14, 15, 16, 17, 18, 20, 22, 24, 26, 27, 28), - c(2, 4, 5, 7, 8, 9, 10, 12, 14, 15, 16, 17, 18, 20, 22, 24, 26, 27, 28), - c(2, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 20, 22, 24, 26, 27, 28), - c(2, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 21, 23, 25, 26, 27, 28), - c(2, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 21, 23, 25, 26, 27, 28, 29), - c(1, 2, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 21, 23, 25, 26, 27, 28, 29) - ) - ), smoothrainbow = list( type = "sequential", interpolate = TRUE, diff --git a/inst/examples/ex-tol-discrete.R b/inst/examples/ex-tol-discrete.R index 9faf026..595b9b3 100644 --- a/inst/examples/ex-tol-discrete.R +++ b/inst/examples/ex-tol-discrete.R @@ -1,4 +1,4 @@ -library(ggplot2) +data(mpg, package = "ggplot2") ggplot2::ggplot(mpg, ggplot2::aes(displ, hwy, colour = class)) + ggplot2::geom_point() + @@ -8,6 +8,8 @@ ggplot2::ggplot(mpg, ggplot2::aes(displ, hwy, colour = class)) + ggplot2::geom_point() + scale_colour_vibrant() +data(diamonds, package = "ggplot2") + ggplot2::ggplot(diamonds, ggplot2::aes(clarity, fill = cut)) + ggplot2::geom_bar() + scale_fill_muted() diff --git a/inst/tinytest/_snaps/info.rds b/inst/tinytest/_snaps/info.rds index f2f8485..b0f3e50 100644 Binary files a/inst/tinytest/_snaps/info.rds and b/inst/tinytest/_snaps/info.rds differ diff --git a/inst/tinytest/test_colour.R b/inst/tinytest/test_colour.R index 521745f..8c20a44 100644 --- a/inst/tinytest/test_colour.R +++ b/inst/tinytest/test_colour.R @@ -37,7 +37,8 @@ for (i in seq_len(nrow(pal_qual))) { expect_error(color(i_pal)(500)) expect_equivalent( unclass(color(i_pal, reverse = TRUE)(i_max)), - rev(color(i_pal, reverse = FALSE)(i_max)) + rev(color(i_pal, reverse = FALSE)(i_max)), + info = i_pal ) } diff --git a/man/scale_crameri_acton.Rd b/man/scale_crameri_acton.Rd index df32d54..340fc2b 100644 --- a/man/scale_crameri_acton.Rd +++ b/man/scale_crameri_acton.Rd @@ -137,7 +137,6 @@ Other sequential color schemes: \code{\link{scale_crameri_tokyo}}, \code{\link{scale_crameri_turku}}, \code{\link{scale_tol_YlOrBr}}, -\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_incandescent}}, \code{\link{scale_tol_iridescent}}, \code{\link{scale_tol_smoothrainbow}} diff --git a/man/scale_crameri_bamako.Rd b/man/scale_crameri_bamako.Rd index f9f411f..c3961d1 100644 --- a/man/scale_crameri_bamako.Rd +++ b/man/scale_crameri_bamako.Rd @@ -137,7 +137,6 @@ Other sequential color schemes: \code{\link{scale_crameri_tokyo}}, \code{\link{scale_crameri_turku}}, \code{\link{scale_tol_YlOrBr}}, -\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_incandescent}}, \code{\link{scale_tol_iridescent}}, \code{\link{scale_tol_smoothrainbow}} diff --git a/man/scale_crameri_batlow.Rd b/man/scale_crameri_batlow.Rd index 4e944a1..1295a78 100644 --- a/man/scale_crameri_batlow.Rd +++ b/man/scale_crameri_batlow.Rd @@ -137,7 +137,6 @@ Other sequential color schemes: \code{\link{scale_crameri_tokyo}}, \code{\link{scale_crameri_turku}}, \code{\link{scale_tol_YlOrBr}}, -\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_incandescent}}, \code{\link{scale_tol_iridescent}}, \code{\link{scale_tol_smoothrainbow}} diff --git a/man/scale_crameri_batlowK.Rd b/man/scale_crameri_batlowK.Rd index f779564..7656265 100644 --- a/man/scale_crameri_batlowK.Rd +++ b/man/scale_crameri_batlowK.Rd @@ -137,7 +137,6 @@ Other sequential color schemes: \code{\link{scale_crameri_tokyo}}, \code{\link{scale_crameri_turku}}, \code{\link{scale_tol_YlOrBr}}, -\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_incandescent}}, \code{\link{scale_tol_iridescent}}, \code{\link{scale_tol_smoothrainbow}} diff --git a/man/scale_crameri_batlowW.Rd b/man/scale_crameri_batlowW.Rd index abad5b3..57dd288 100644 --- a/man/scale_crameri_batlowW.Rd +++ b/man/scale_crameri_batlowW.Rd @@ -137,7 +137,6 @@ Other sequential color schemes: \code{\link{scale_crameri_tokyo}}, \code{\link{scale_crameri_turku}}, \code{\link{scale_tol_YlOrBr}}, -\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_incandescent}}, \code{\link{scale_tol_iridescent}}, \code{\link{scale_tol_smoothrainbow}} diff --git a/man/scale_crameri_bilbao.Rd b/man/scale_crameri_bilbao.Rd index bcfa0a5..61dc3c8 100644 --- a/man/scale_crameri_bilbao.Rd +++ b/man/scale_crameri_bilbao.Rd @@ -137,7 +137,6 @@ Other sequential color schemes: \code{\link{scale_crameri_tokyo}}, \code{\link{scale_crameri_turku}}, \code{\link{scale_tol_YlOrBr}}, -\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_incandescent}}, \code{\link{scale_tol_iridescent}}, \code{\link{scale_tol_smoothrainbow}} diff --git a/man/scale_crameri_buda.Rd b/man/scale_crameri_buda.Rd index 1242010..5c88522 100644 --- a/man/scale_crameri_buda.Rd +++ b/man/scale_crameri_buda.Rd @@ -137,7 +137,6 @@ Other sequential color schemes: \code{\link{scale_crameri_tokyo}}, \code{\link{scale_crameri_turku}}, \code{\link{scale_tol_YlOrBr}}, -\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_incandescent}}, \code{\link{scale_tol_iridescent}}, \code{\link{scale_tol_smoothrainbow}} diff --git a/man/scale_crameri_davos.Rd b/man/scale_crameri_davos.Rd index e53914b..a754820 100644 --- a/man/scale_crameri_davos.Rd +++ b/man/scale_crameri_davos.Rd @@ -137,7 +137,6 @@ Other sequential color schemes: \code{\link{scale_crameri_tokyo}}, \code{\link{scale_crameri_turku}}, \code{\link{scale_tol_YlOrBr}}, -\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_incandescent}}, \code{\link{scale_tol_iridescent}}, \code{\link{scale_tol_smoothrainbow}} diff --git a/man/scale_crameri_devon.Rd b/man/scale_crameri_devon.Rd index ee70def..19b8a03 100644 --- a/man/scale_crameri_devon.Rd +++ b/man/scale_crameri_devon.Rd @@ -137,7 +137,6 @@ Other sequential color schemes: \code{\link{scale_crameri_tokyo}}, \code{\link{scale_crameri_turku}}, \code{\link{scale_tol_YlOrBr}}, -\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_incandescent}}, \code{\link{scale_tol_iridescent}}, \code{\link{scale_tol_smoothrainbow}} diff --git a/man/scale_crameri_grayC.Rd b/man/scale_crameri_grayC.Rd index f9be0f7..bf99f7f 100644 --- a/man/scale_crameri_grayC.Rd +++ b/man/scale_crameri_grayC.Rd @@ -137,7 +137,6 @@ Other sequential color schemes: \code{\link{scale_crameri_tokyo}}, \code{\link{scale_crameri_turku}}, \code{\link{scale_tol_YlOrBr}}, -\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_incandescent}}, \code{\link{scale_tol_iridescent}}, \code{\link{scale_tol_smoothrainbow}} diff --git a/man/scale_crameri_hawaii.Rd b/man/scale_crameri_hawaii.Rd index 74bcfec..11eae1d 100644 --- a/man/scale_crameri_hawaii.Rd +++ b/man/scale_crameri_hawaii.Rd @@ -137,7 +137,6 @@ Other sequential color schemes: \code{\link{scale_crameri_tokyo}}, \code{\link{scale_crameri_turku}}, \code{\link{scale_tol_YlOrBr}}, -\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_incandescent}}, \code{\link{scale_tol_iridescent}}, \code{\link{scale_tol_smoothrainbow}} diff --git a/man/scale_crameri_imola.Rd b/man/scale_crameri_imola.Rd index e1aa2de..36d2b9b 100644 --- a/man/scale_crameri_imola.Rd +++ b/man/scale_crameri_imola.Rd @@ -137,7 +137,6 @@ Other sequential color schemes: \code{\link{scale_crameri_tokyo}}, \code{\link{scale_crameri_turku}}, \code{\link{scale_tol_YlOrBr}}, -\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_incandescent}}, \code{\link{scale_tol_iridescent}}, \code{\link{scale_tol_smoothrainbow}} diff --git a/man/scale_crameri_lajolla.Rd b/man/scale_crameri_lajolla.Rd index dfeb78d..e4a1f4b 100644 --- a/man/scale_crameri_lajolla.Rd +++ b/man/scale_crameri_lajolla.Rd @@ -137,7 +137,6 @@ Other sequential color schemes: \code{\link{scale_crameri_tokyo}}, \code{\link{scale_crameri_turku}}, \code{\link{scale_tol_YlOrBr}}, -\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_incandescent}}, \code{\link{scale_tol_iridescent}}, \code{\link{scale_tol_smoothrainbow}} diff --git a/man/scale_crameri_lapaz.Rd b/man/scale_crameri_lapaz.Rd index 2bda437..b4245d3 100644 --- a/man/scale_crameri_lapaz.Rd +++ b/man/scale_crameri_lapaz.Rd @@ -137,7 +137,6 @@ Other sequential color schemes: \code{\link{scale_crameri_tokyo}}, \code{\link{scale_crameri_turku}}, \code{\link{scale_tol_YlOrBr}}, -\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_incandescent}}, \code{\link{scale_tol_iridescent}}, \code{\link{scale_tol_smoothrainbow}} diff --git a/man/scale_crameri_nuuk.Rd b/man/scale_crameri_nuuk.Rd index c78d772..d3be788 100644 --- a/man/scale_crameri_nuuk.Rd +++ b/man/scale_crameri_nuuk.Rd @@ -137,7 +137,6 @@ Other sequential color schemes: \code{\link{scale_crameri_tokyo}}, \code{\link{scale_crameri_turku}}, \code{\link{scale_tol_YlOrBr}}, -\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_incandescent}}, \code{\link{scale_tol_iridescent}}, \code{\link{scale_tol_smoothrainbow}} diff --git a/man/scale_crameri_oslo.Rd b/man/scale_crameri_oslo.Rd index 3d52225..b9c558b 100644 --- a/man/scale_crameri_oslo.Rd +++ b/man/scale_crameri_oslo.Rd @@ -137,7 +137,6 @@ Other sequential color schemes: \code{\link{scale_crameri_tokyo}}, \code{\link{scale_crameri_turku}}, \code{\link{scale_tol_YlOrBr}}, -\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_incandescent}}, \code{\link{scale_tol_iridescent}}, \code{\link{scale_tol_smoothrainbow}} diff --git a/man/scale_crameri_tokyo.Rd b/man/scale_crameri_tokyo.Rd index 4f7ecf2..fd5a651 100644 --- a/man/scale_crameri_tokyo.Rd +++ b/man/scale_crameri_tokyo.Rd @@ -137,7 +137,6 @@ Other sequential color schemes: \code{\link{scale_crameri_oslo}}, \code{\link{scale_crameri_turku}}, \code{\link{scale_tol_YlOrBr}}, -\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_incandescent}}, \code{\link{scale_tol_iridescent}}, \code{\link{scale_tol_smoothrainbow}} diff --git a/man/scale_crameri_turku.Rd b/man/scale_crameri_turku.Rd index 8fe22ba..0ab0ca1 100644 --- a/man/scale_crameri_turku.Rd +++ b/man/scale_crameri_turku.Rd @@ -137,7 +137,6 @@ Other sequential color schemes: \code{\link{scale_crameri_oslo}}, \code{\link{scale_crameri_tokyo}}, \code{\link{scale_tol_YlOrBr}}, -\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_incandescent}}, \code{\link{scale_tol_iridescent}}, \code{\link{scale_tol_smoothrainbow}} diff --git a/man/scale_land.Rd b/man/scale_land.Rd index ea9e93d..f1ce1b7 100644 --- a/man/scale_land.Rd +++ b/man/scale_land.Rd @@ -78,6 +78,7 @@ Other qualitative color schemes: \code{\link{scale_okabeito_discrete}}, \code{\link{scale_tol_bright}}, \code{\link{scale_tol_dark}}, +\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_highcontrast}}, \code{\link{scale_tol_light}}, \code{\link{scale_tol_mediumcontrast}}, diff --git a/man/scale_logical_discrete.Rd b/man/scale_logical_discrete.Rd index 2221d9c..9a7864c 100644 --- a/man/scale_logical_discrete.Rd +++ b/man/scale_logical_discrete.Rd @@ -46,6 +46,7 @@ Other qualitative color schemes: \code{\link{scale_okabeito_discrete}}, \code{\link{scale_tol_bright}}, \code{\link{scale_tol_dark}}, +\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_highcontrast}}, \code{\link{scale_tol_light}}, \code{\link{scale_tol_mediumcontrast}}, diff --git a/man/scale_okabeito_discrete.Rd b/man/scale_okabeito_discrete.Rd index f73c917..c26f50e 100644 --- a/man/scale_okabeito_discrete.Rd +++ b/man/scale_okabeito_discrete.Rd @@ -108,6 +108,7 @@ Other qualitative color schemes: \code{\link{scale_logical_discrete}}, \code{\link{scale_tol_bright}}, \code{\link{scale_tol_dark}}, +\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_highcontrast}}, \code{\link{scale_tol_light}}, \code{\link{scale_tol_mediumcontrast}}, diff --git a/man/scale_soil.Rd b/man/scale_soil.Rd index e210cbd..41685eb 100644 --- a/man/scale_soil.Rd +++ b/man/scale_soil.Rd @@ -76,6 +76,7 @@ Other qualitative color schemes: \code{\link{scale_okabeito_discrete}}, \code{\link{scale_tol_bright}}, \code{\link{scale_tol_dark}}, +\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_highcontrast}}, \code{\link{scale_tol_light}}, \code{\link{scale_tol_mediumcontrast}}, diff --git a/man/scale_stratigraphy.Rd b/man/scale_stratigraphy.Rd index f645455..d89caf5 100644 --- a/man/scale_stratigraphy.Rd +++ b/man/scale_stratigraphy.Rd @@ -84,6 +84,7 @@ Other qualitative color schemes: \code{\link{scale_okabeito_discrete}}, \code{\link{scale_tol_bright}}, \code{\link{scale_tol_dark}}, +\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_highcontrast}}, \code{\link{scale_tol_light}}, \code{\link{scale_tol_mediumcontrast}}, diff --git a/man/scale_tol_YlOrBr.Rd b/man/scale_tol_YlOrBr.Rd index 4d89960..bdbbca2 100644 --- a/man/scale_tol_YlOrBr.Rd +++ b/man/scale_tol_YlOrBr.Rd @@ -130,7 +130,6 @@ Other sequential color schemes: \code{\link{scale_crameri_oslo}}, \code{\link{scale_crameri_tokyo}}, \code{\link{scale_crameri_turku}}, -\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_incandescent}}, \code{\link{scale_tol_iridescent}}, \code{\link{scale_tol_smoothrainbow}} diff --git a/man/scale_tol_bright.Rd b/man/scale_tol_bright.Rd index 4fd43dc..041cdd7 100644 --- a/man/scale_tol_bright.Rd +++ b/man/scale_tol_bright.Rd @@ -62,7 +62,7 @@ references). } \examples{ -library(ggplot2) +data(mpg, package = "ggplot2") ggplot2::ggplot(mpg, ggplot2::aes(displ, hwy, colour = class)) + ggplot2::geom_point() + @@ -72,6 +72,8 @@ ggplot2::ggplot(mpg, ggplot2::aes(displ, hwy, colour = class)) + ggplot2::geom_point() + scale_colour_vibrant() +data(diamonds, package = "ggplot2") + ggplot2::ggplot(diamonds, ggplot2::aes(clarity, fill = cut)) + ggplot2::geom_bar() + scale_fill_muted() @@ -89,6 +91,7 @@ Other qualitative color schemes: \code{\link{scale_logical_discrete}}, \code{\link{scale_okabeito_discrete}}, \code{\link{scale_tol_dark}}, +\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_highcontrast}}, \code{\link{scale_tol_light}}, \code{\link{scale_tol_mediumcontrast}}, diff --git a/man/scale_tol_dark.Rd b/man/scale_tol_dark.Rd index aa9ede6..5b2d395 100644 --- a/man/scale_tol_dark.Rd +++ b/man/scale_tol_dark.Rd @@ -62,7 +62,7 @@ references). } \examples{ -library(ggplot2) +data(mpg, package = "ggplot2") ggplot2::ggplot(mpg, ggplot2::aes(displ, hwy, colour = class)) + ggplot2::geom_point() + @@ -72,6 +72,8 @@ ggplot2::ggplot(mpg, ggplot2::aes(displ, hwy, colour = class)) + ggplot2::geom_point() + scale_colour_vibrant() +data(diamonds, package = "ggplot2") + ggplot2::ggplot(diamonds, ggplot2::aes(clarity, fill = cut)) + ggplot2::geom_bar() + scale_fill_muted() @@ -89,6 +91,7 @@ Other qualitative color schemes: \code{\link{scale_logical_discrete}}, \code{\link{scale_okabeito_discrete}}, \code{\link{scale_tol_bright}}, +\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_highcontrast}}, \code{\link{scale_tol_light}}, \code{\link{scale_tol_mediumcontrast}}, diff --git a/man/scale_tol_discrete.Rd b/man/scale_tol_discrete.Rd index 0a96caf..d82b331 100644 --- a/man/scale_tol_discrete.Rd +++ b/man/scale_tol_discrete.Rd @@ -60,7 +60,7 @@ references). } \examples{ -library(ggplot2) +data(mpg, package = "ggplot2") ggplot2::ggplot(mpg, ggplot2::aes(displ, hwy, colour = class)) + ggplot2::geom_point() + @@ -70,6 +70,8 @@ ggplot2::ggplot(mpg, ggplot2::aes(displ, hwy, colour = class)) + ggplot2::geom_point() + scale_colour_vibrant() +data(diamonds, package = "ggplot2") + ggplot2::ggplot(diamonds, ggplot2::aes(clarity, fill = cut)) + ggplot2::geom_bar() + scale_fill_muted() diff --git a/man/scale_tol_discreterainbow.Rd b/man/scale_tol_discreterainbow.Rd index ccd2f38..1399114 100644 --- a/man/scale_tol_discreterainbow.Rd +++ b/man/scale_tol_discreterainbow.Rd @@ -40,7 +40,7 @@ vector of colors be reversed?} strings listing the name(s) of the aesthetic(s) that this scale works with.} } \value{ -A \link[ggplot2:continuous_scale]{continuous} scale. +A \link[ggplot2:discrete_scale]{discrete} scale. } \description{ Paul Tol's \emph{discrete rainbow} Sequential Color Scheme @@ -79,19 +79,21 @@ range.} } \examples{ -data(faithfuld, package = "ggplot2") +data(mpg, package = "ggplot2") -ggplot2::ggplot(faithfuld, ggplot2::aes(waiting, eruptions, fill = density)) + - ggplot2::geom_raster() + - scale_fill_YlOrBr() +ggplot2::ggplot(mpg, ggplot2::aes(displ, hwy, colour = class)) + + ggplot2::geom_point() + + scale_colour_bright() -ggplot2::ggplot(faithfuld, ggplot2::aes(waiting, eruptions, fill = density)) + - ggplot2::geom_raster() + - scale_fill_iridescent(reverse = TRUE) +ggplot2::ggplot(mpg, ggplot2::aes(displ, hwy, colour = class)) + + ggplot2::geom_point() + + scale_colour_vibrant() -ggplot2::ggplot(faithfuld, ggplot2::aes(waiting, eruptions, fill = density)) + - ggplot2::geom_raster() + - scale_fill_smoothrainbow(range = c(0.25, 1)) +data(diamonds, package = "ggplot2") + +ggplot2::ggplot(diamonds, ggplot2::aes(clarity, fill = cut)) + + ggplot2::geom_bar() + + scale_fill_muted() } \references{ Tol, P. (2018). \emph{Colour Schemes}. SRON. Technical Note No. @@ -99,29 +101,20 @@ SRON/EPS/TN/09-002, issue 3.1. URL: \url{https://personal.sron.nl/~pault/data/colourschemes.pdf} } \seealso{ -Other sequential color schemes: -\code{\link{scale_crameri_acton}}, -\code{\link{scale_crameri_bamako}}, -\code{\link{scale_crameri_batlowK}}, -\code{\link{scale_crameri_batlowW}}, -\code{\link{scale_crameri_batlow}}, -\code{\link{scale_crameri_bilbao}}, -\code{\link{scale_crameri_buda}}, -\code{\link{scale_crameri_davos}}, -\code{\link{scale_crameri_devon}}, -\code{\link{scale_crameri_grayC}}, -\code{\link{scale_crameri_hawaii}}, -\code{\link{scale_crameri_imola}}, -\code{\link{scale_crameri_lajolla}}, -\code{\link{scale_crameri_lapaz}}, -\code{\link{scale_crameri_nuuk}}, -\code{\link{scale_crameri_oslo}}, -\code{\link{scale_crameri_tokyo}}, -\code{\link{scale_crameri_turku}}, -\code{\link{scale_tol_YlOrBr}}, -\code{\link{scale_tol_incandescent}}, -\code{\link{scale_tol_iridescent}}, -\code{\link{scale_tol_smoothrainbow}} +Other qualitative color schemes: +\code{\link{scale_colour_land}()}, +\code{\link{scale_colour_soil}()}, +\code{\link{scale_colour_stratigraphy}()}, +\code{\link{scale_logical_discrete}}, +\code{\link{scale_okabeito_discrete}}, +\code{\link{scale_tol_bright}}, +\code{\link{scale_tol_dark}}, +\code{\link{scale_tol_highcontrast}}, +\code{\link{scale_tol_light}}, +\code{\link{scale_tol_mediumcontrast}}, +\code{\link{scale_tol_muted}}, +\code{\link{scale_tol_pale}}, +\code{\link{scale_tol_vibrant}} Other Paul Tol's color schemes: \code{\link{scale_tol_BuRd}}, @@ -145,4 +138,4 @@ Other Paul Tol's color schemes: N. Frerebeau } \concept{Paul Tol's color schemes} -\concept{sequential color schemes} +\concept{qualitative color schemes} diff --git a/man/scale_tol_highcontrast.Rd b/man/scale_tol_highcontrast.Rd index e0f7253..6b98073 100644 --- a/man/scale_tol_highcontrast.Rd +++ b/man/scale_tol_highcontrast.Rd @@ -66,7 +66,7 @@ references). } \examples{ -library(ggplot2) +data(mpg, package = "ggplot2") ggplot2::ggplot(mpg, ggplot2::aes(displ, hwy, colour = class)) + ggplot2::geom_point() + @@ -76,6 +76,8 @@ ggplot2::ggplot(mpg, ggplot2::aes(displ, hwy, colour = class)) + ggplot2::geom_point() + scale_colour_vibrant() +data(diamonds, package = "ggplot2") + ggplot2::ggplot(diamonds, ggplot2::aes(clarity, fill = cut)) + ggplot2::geom_bar() + scale_fill_muted() @@ -94,6 +96,7 @@ Other qualitative color schemes: \code{\link{scale_okabeito_discrete}}, \code{\link{scale_tol_bright}}, \code{\link{scale_tol_dark}}, +\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_light}}, \code{\link{scale_tol_mediumcontrast}}, \code{\link{scale_tol_muted}}, diff --git a/man/scale_tol_incandescent.Rd b/man/scale_tol_incandescent.Rd index 078d41e..311df22 100644 --- a/man/scale_tol_incandescent.Rd +++ b/man/scale_tol_incandescent.Rd @@ -131,7 +131,6 @@ Other sequential color schemes: \code{\link{scale_crameri_tokyo}}, \code{\link{scale_crameri_turku}}, \code{\link{scale_tol_YlOrBr}}, -\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_iridescent}}, \code{\link{scale_tol_smoothrainbow}} diff --git a/man/scale_tol_iridescent.Rd b/man/scale_tol_iridescent.Rd index b4b7deb..2ba6098 100644 --- a/man/scale_tol_iridescent.Rd +++ b/man/scale_tol_iridescent.Rd @@ -131,7 +131,6 @@ Other sequential color schemes: \code{\link{scale_crameri_tokyo}}, \code{\link{scale_crameri_turku}}, \code{\link{scale_tol_YlOrBr}}, -\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_incandescent}}, \code{\link{scale_tol_smoothrainbow}} diff --git a/man/scale_tol_light.Rd b/man/scale_tol_light.Rd index 8ac13ac..a9688d0 100644 --- a/man/scale_tol_light.Rd +++ b/man/scale_tol_light.Rd @@ -62,7 +62,7 @@ references). } \examples{ -library(ggplot2) +data(mpg, package = "ggplot2") ggplot2::ggplot(mpg, ggplot2::aes(displ, hwy, colour = class)) + ggplot2::geom_point() + @@ -72,6 +72,8 @@ ggplot2::ggplot(mpg, ggplot2::aes(displ, hwy, colour = class)) + ggplot2::geom_point() + scale_colour_vibrant() +data(diamonds, package = "ggplot2") + ggplot2::ggplot(diamonds, ggplot2::aes(clarity, fill = cut)) + ggplot2::geom_bar() + scale_fill_muted() @@ -90,6 +92,7 @@ Other qualitative color schemes: \code{\link{scale_okabeito_discrete}}, \code{\link{scale_tol_bright}}, \code{\link{scale_tol_dark}}, +\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_highcontrast}}, \code{\link{scale_tol_mediumcontrast}}, \code{\link{scale_tol_muted}}, diff --git a/man/scale_tol_mediumcontrast.Rd b/man/scale_tol_mediumcontrast.Rd index 0242a35..fabcc0e 100644 --- a/man/scale_tol_mediumcontrast.Rd +++ b/man/scale_tol_mediumcontrast.Rd @@ -70,7 +70,7 @@ references). } \examples{ -library(ggplot2) +data(mpg, package = "ggplot2") ggplot2::ggplot(mpg, ggplot2::aes(displ, hwy, colour = class)) + ggplot2::geom_point() + @@ -80,6 +80,8 @@ ggplot2::ggplot(mpg, ggplot2::aes(displ, hwy, colour = class)) + ggplot2::geom_point() + scale_colour_vibrant() +data(diamonds, package = "ggplot2") + ggplot2::ggplot(diamonds, ggplot2::aes(clarity, fill = cut)) + ggplot2::geom_bar() + scale_fill_muted() @@ -98,6 +100,7 @@ Other qualitative color schemes: \code{\link{scale_okabeito_discrete}}, \code{\link{scale_tol_bright}}, \code{\link{scale_tol_dark}}, +\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_highcontrast}}, \code{\link{scale_tol_light}}, \code{\link{scale_tol_muted}}, diff --git a/man/scale_tol_muted.Rd b/man/scale_tol_muted.Rd index 122410c..a6ad46b 100644 --- a/man/scale_tol_muted.Rd +++ b/man/scale_tol_muted.Rd @@ -59,7 +59,7 @@ references). } \examples{ -library(ggplot2) +data(mpg, package = "ggplot2") ggplot2::ggplot(mpg, ggplot2::aes(displ, hwy, colour = class)) + ggplot2::geom_point() + @@ -69,6 +69,8 @@ ggplot2::ggplot(mpg, ggplot2::aes(displ, hwy, colour = class)) + ggplot2::geom_point() + scale_colour_vibrant() +data(diamonds, package = "ggplot2") + ggplot2::ggplot(diamonds, ggplot2::aes(clarity, fill = cut)) + ggplot2::geom_bar() + scale_fill_muted() @@ -87,6 +89,7 @@ Other qualitative color schemes: \code{\link{scale_okabeito_discrete}}, \code{\link{scale_tol_bright}}, \code{\link{scale_tol_dark}}, +\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_highcontrast}}, \code{\link{scale_tol_light}}, \code{\link{scale_tol_mediumcontrast}}, diff --git a/man/scale_tol_pale.Rd b/man/scale_tol_pale.Rd index 4e8ebe7..404b026 100644 --- a/man/scale_tol_pale.Rd +++ b/man/scale_tol_pale.Rd @@ -62,7 +62,7 @@ references). } \examples{ -library(ggplot2) +data(mpg, package = "ggplot2") ggplot2::ggplot(mpg, ggplot2::aes(displ, hwy, colour = class)) + ggplot2::geom_point() + @@ -72,6 +72,8 @@ ggplot2::ggplot(mpg, ggplot2::aes(displ, hwy, colour = class)) + ggplot2::geom_point() + scale_colour_vibrant() +data(diamonds, package = "ggplot2") + ggplot2::ggplot(diamonds, ggplot2::aes(clarity, fill = cut)) + ggplot2::geom_bar() + scale_fill_muted() @@ -90,6 +92,7 @@ Other qualitative color schemes: \code{\link{scale_okabeito_discrete}}, \code{\link{scale_tol_bright}}, \code{\link{scale_tol_dark}}, +\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_highcontrast}}, \code{\link{scale_tol_light}}, \code{\link{scale_tol_mediumcontrast}}, diff --git a/man/scale_tol_smoothrainbow.Rd b/man/scale_tol_smoothrainbow.Rd index 73e0c81..f6887b4 100644 --- a/man/scale_tol_smoothrainbow.Rd +++ b/man/scale_tol_smoothrainbow.Rd @@ -154,7 +154,6 @@ Other sequential color schemes: \code{\link{scale_crameri_tokyo}}, \code{\link{scale_crameri_turku}}, \code{\link{scale_tol_YlOrBr}}, -\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_incandescent}}, \code{\link{scale_tol_iridescent}} diff --git a/man/scale_tol_vibrant.Rd b/man/scale_tol_vibrant.Rd index f95e9e2..213143d 100644 --- a/man/scale_tol_vibrant.Rd +++ b/man/scale_tol_vibrant.Rd @@ -62,7 +62,7 @@ references). } \examples{ -library(ggplot2) +data(mpg, package = "ggplot2") ggplot2::ggplot(mpg, ggplot2::aes(displ, hwy, colour = class)) + ggplot2::geom_point() + @@ -72,6 +72,8 @@ ggplot2::ggplot(mpg, ggplot2::aes(displ, hwy, colour = class)) + ggplot2::geom_point() + scale_colour_vibrant() +data(diamonds, package = "ggplot2") + ggplot2::ggplot(diamonds, ggplot2::aes(clarity, fill = cut)) + ggplot2::geom_bar() + scale_fill_muted() @@ -90,6 +92,7 @@ Other qualitative color schemes: \code{\link{scale_okabeito_discrete}}, \code{\link{scale_tol_bright}}, \code{\link{scale_tol_dark}}, +\code{\link{scale_tol_discreterainbow}}, \code{\link{scale_tol_highcontrast}}, \code{\link{scale_tol_light}}, \code{\link{scale_tol_mediumcontrast}},