Description Usage Arguments Examples
This function converts color codes (given in hexadecimal format) to constrasted gray levels. This is useful to enhance readability when printing in black and white. The conversion from color to gray levels is performed using the luminosity method (0.21R + 0.72G + 0.07B), then levels are linearly scaled to [contrast.min;contrast.max].
1 2 | color2blackwhite(x, increase.contrast = TRUE, contrast.min = 0.02,
contrast.max = 0.98)
|
x |
a |
increase.contrast |
a |
contrast.min |
the minimal gray value to use in the scaling (0 = white, 1 = black). |
contrast.max |
the maximal gray value to use in the scaling (0 = white, 1 = black). |
1 2 3 4 5 6 7 | mycols = c("#BA364E", "#32BAA1", "#12AA91")
color2blackwhite(mycols)
barplot(1:3, axes=FALSE, col=mycols)
barplot(1:3, axes=FALSE, col=color2blackwhite(mycols, increase.contrast = FALSE))
barplot(1:3, axes=FALSE, col=color2blackwhite(mycols))
barplot(1:3, axes=FALSE, col=color2blackwhite(mycols, contrast.min = 0, contrast.max = 1))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.