dichromat: Remove Red-Green or Green-Blue Contrasts from Colors

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/dichromat.R

Description

Collapses red-green or green-blue color distinctions to approximate the effect of the three forms of dichromacy: protanopia and deuteranopia (red-green color blindness), and tritanopia (green-blue color blindness). deuteranopia.

Usage

1
dichromat(colours, type = c("deutan", "protan", "tritan"))

Arguments

colours

A vector of R colors, either color names or color hex strings.

type

Type of color-blindness to simulate,

Details

Someone with the specified form of color blindness will find that the transformation has little effect on the appearance of colors. Colors that are indistinguishable after transformation were likely indistinguishable to them before transformation. About 10% of men (and almost no women) have some degree of red-green color blindness. Tritanopia is much less common but occurs in both males and females.

The mapping from the original color vector to the dichromatic counterpart is based on a sequence of papers by Brettel, Mollon, and Viénot. For more details, see the references and also the underlying data set dalton.

Value

A vector of R colors.

Author(s)

Thomas Lumley

References

Brettel H, Viénot F, Mollon, JD (1997). Computerized Simulation of Color Appearance for Dichromats. Journal of the Optical Society of America A, 14, 2647–2655.

Lumley T (2006). Color-Coding and Color Blindness in Statistical Graphics. ASA Statistical Computing & Graphics Newsletter, 17(2), 4–7. http://www.amstat-online.org/sections/graphics/newsletter/Volumes/v172.pdf

Viénot F, Brettel H, Ott L, M'Barek AB, Mollon JD (1995). What Do Colour-Blind People See? Nature, 376, 127–128.

Viénot F, Brettel H, Mollon JD (1999). Digital Video Colourmaps for Checking the Legibility of Displays by Dichromats. Color Research and Application, 24(4), 243–252.

Wikipedia (2013). Color Blindness – Wikipedia, The Free Encyclopedia. http://en.wikipedia.org/wiki/Color_blindness, accessed 2013-01-16.

Wikipedia (2013). Dichromacy – Wikipedia, The Free Encyclopedia. http://en.wikipedia.org/wiki/Dichromacy, accessed 2013-01-16.

See Also

dalton, rgb

Examples

 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
## from example(pie)
 par(mfrow = c(2, 2))
 pie.sales <- c(0.12, 0.3, 0.26, 0.16, 0.04, 0.12)
 names(pie.sales) <- c("Blueberry", "Cherry",
   "Apple", "Boston Cream", "Other", "Vanilla Cream")
 pie(pie.sales, # default colors
   col = c("white", "lightblue", "mistyrose", "lightcyan", "lavender", "cornsilk"))
 pie(pie.sales,
   col = c("purple", "violetred1", "green3", "cornsilk", "cyan", "white"))
 pie(pie.sales, col = dichromat(
   c("white", "lightblue", "mistyrose", "lightcyan", "lavender", "cornsilk")))
 pie(pie.sales, col = dichromat(
   c("purple", "violetred1", "green3", "cornsilk", "cyan", "white")))


## standard color schemes
pie(rep(1,10), col = heat.colors(10))
pie(rep(1,10), col = dichromat(heat.colors(10)))
pie(rep(1,8),  col = palette())
pie(rep(1,8),  col = dichromat(palette()))

pie(rep(1,15), col = topo.colors(15))
pie(rep(1,15), col = dichromat(topo.colors(15)))
pie(rep(1,15), col = terrain.colors(15))
pie(rep(1,15), col = dichromat(terrain.colors(15)))

pie(rep(1,15), col = cm.colors(15))
pie(rep(1,15), col = dichromat(cm.colors(15)))

## color ramp schemes
bluescale <- colorRampPalette(c("#FFFFCC", "#C7E9B4", "#7FCDBB",
  "#40B6C4", "#2C7FB8" , "#253494"))
redgreen <- colorRampPalette(c("red", "green3"))
pie(rep(1,15), col = bluescale(15))
pie(rep(1,15), col = dichromat(bluescale(15)))

par(mfrow = c(2, 4))
x <- matrix(rnorm(10 * 10), 10)
image(1:10, 1:10, x, col = bluescale(10), main = "blue-yellow scale")
image(1:10, 1:10, x, col = dichromat(bluescale(10), "deutan"), main = "deutan")
image(1:10, 1:10, x, col = dichromat(bluescale(10), "protan"), main = "protan")
image(1:10, 1:10, x, col = dichromat(bluescale(10), "tritan"), main = "tritan")

image(1:10, 1:10, x, col = redgreen(10), main = "red-green scale")
image(1:10, 1:10, x, col = dichromat(redgreen(10), "deutan"), main = "deutan")
image(1:10, 1:10, x, col = dichromat(redgreen(10), "protan"), main = "protan")
image(1:10, 1:10, x, col = dichromat(redgreen(10), "tritan"), main = "tritan")

Example output



dichromat documentation built on May 2, 2019, 2:13 p.m.