Skip to content

Commit 8a88720

Browse files
Ahobertpaleolimbot
authored andcommitted
advice users regarding colourblindness (#3417, closes #2863)
* added section on color blindness to scale-continuous * added section on colour blindness to scale-manual
1 parent a312cb4 commit 8a88720

File tree

4 files changed

+69
-3
lines changed

4 files changed

+69
-3
lines changed

R/scale-colour.r

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,36 @@
44
#' `ggplot2.continuous.colour` and `ggplot2.continuous.fill` options. If these
55
#' options are not present, `"gradient"` will be used. See [options()] for more
66
#' information.
7-
#'
7+
#'
88
#' @param ... Additional parameters passed on to the scale type
99
#' @param type One of "gradient" (the default) or "viridis" indicating the
1010
#' colour scale to use
1111
#' @seealso [scale_colour_gradient()], [scale_colour_viridis_c()],
1212
#' [scale_fill_gradient()], and [scale_fill_viridis_c()]
1313
#' @export
1414
#' @rdname scale_colour_continuous
15+
#' @section Color Blindness:
16+
#' Many color palettes derived from RGB combinations (like the "rainbow" color
17+
#' palette) are not suitable to support all viewers, especially those with
18+
#' color vision deficiencies. Using `viridis` type, which is perceptually
19+
#' uniform in both colour and black-and-white display is an easy option to
20+
#' ensure good perceptive properties of your visulizations.
21+
#' The colorspace package offers functionalities
22+
#' - to generate color palettes with good perceptive properties,
23+
#' - to analyse a given color palette, like emulating color blindness,
24+
#' - and to modify a given color palette for better perceptivity.
25+
#'
26+
#' For more information on color vision deficiencies and suitable color choices
27+
#' see the [paper on the colorspace package](https://arxiv.org/abs/1903.06490)
28+
#' and references therein.
1529
#' @examples
1630
#' v <- ggplot(faithfuld, aes(waiting, eruptions, fill = density)) +
1731
#' geom_tile()
1832
#' v
19-
#'
33+
#'
2034
#' v + scale_fill_continuous(type = "gradient")
2135
#' v + scale_fill_continuous(type = "viridis")
22-
#'
36+
#'
2337
#' # The above are equivalent to
2438
#' v + scale_fill_gradient()
2539
#' v + scale_fill_viridis_c()

R/scale-manual.r

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@
2222
#' If unnamed, values will be matched in order (usually alphabetical) with
2323
#' the limits of the scale. Any data values that don't match will be
2424
#' given `na.value`.
25+
#' @section Color Blindness:
26+
#' Many color palettes derived from RGB combinations (like the "rainbow" color
27+
#' palette) are not suitable to support all viewers, especially those with
28+
#' color vision deficiencies. Using `viridis` type, which is perceptually
29+
#' uniform in both colour and black-and-white display is an easy option to
30+
#' ensure good perceptive properties of your visulizations.
31+
#' The colorspace package offers functionalities
32+
#' - to generate color palettes with good perceptive properties,
33+
#' - to analyse a given color palette, like emulating color blindness,
34+
#' - and to modify a given color palette for better perceptivity.
35+
#'
36+
#' For more information on color vision deficiencies and suitable color choices
37+
#' see the [paper on the colorspace package](https://arxiv.org/abs/1903.06490)
38+
#' and references therein.
2539
#' @examples
2640
#' p <- ggplot(mtcars, aes(mpg, wt)) +
2741
#' geom_point(aes(colour = factor(cyl)))

man/scale_colour_continuous.Rd

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/scale_manual.Rd

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)