Title: | Safe Color Set for Color Blindness |
---|---|
Description: | Provide the safe color set for color blindness, the simulator of protanopia, deuteranopia. The color sets are collected from: Wong, B. (2011) <doi:10.1038/nmeth.1618>, and <http://mkweb.bcgsc.ca/biovis2012/>. The simulations of the appearance of the colors to color-deficient viewers were based on algorithms in Vienot, F., Brettel, H. and Mollon, J.D. (1999) <doi:10.1002/(SICI)1520-6378(199908)24:4%3C243::AID-COL5%3E3.0.CO;2-3>. The cvdPlot() function to generate 'ggplot' grobs of simulations were modified from <https://github.com/clauswilke/colorblindr>. |
Authors: | Jianhong Ou [aut, cre] |
Maintainer: | Jianhong Ou <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.1.9 |
Built: | 2024-11-02 03:57:16 UTC |
Source: | https://github.com/cran/colorBlindness |
export available colors
availableColors()
availableColors()
a character vector contain safe colors.
availableColors()
availableColors()
List all the available color palettes.
availablePalette()
availablePalette()
a character vector contain available color palettes.
availablePalette()
availablePalette()
color blindness safe colors
BLACK ORANGE SKY_BLUE BLUISH_GREEN YELLOW BLUE VERMILLION REDDISH_PURPLE safeColors
BLACK ORANGE SKY_BLUE BLUISH_GREEN YELLOW BLUE VERMILLION REDDISH_PURPLE safeColors
An object of class character
of length 1.
An object of class character
of length 1.
An object of class character
of length 1.
An object of class character
of length 1.
An object of class character
of length 1.
An object of class character
of length 1.
An object of class character
of length 1.
An object of class character
of length 1.
An object of class character
of length 8.
Wong, B. (2011) <doi:10.1038/nmeth.1642> Wong, B. (2011) <doi:10.1038/nmeth.1618>
safeColors
safeColors
export available color names
colorNames()
colorNames()
a character vector contain safe colors.
colorNames()
colorNames()
Plot the color-deficiency simulations for ggplot grob.
cvdPlot( plot = last_plot(), layout = c("origin", "deuteranope", "protanope", "desaturate") )
cvdPlot( plot = last_plot(), layout = c("origin", "deuteranope", "protanope", "desaturate") )
plot |
The grob to be plotted. |
layout |
The sub-figure types. the choices are origin, deuteranope, protanope, desaturate, and enhanced, enhanced.deuteranope, enhanced.protanope, enhanced.desaturate. |
This function is modified from <https://github.com/clauswilke/colorblindr>
An object of ggplot.
cvdPlot(displayColors(safeColors)) cvdPlot(displayColors(paletteMartin))
cvdPlot(displayColors(safeColors)) cvdPlot(displayColors(paletteMartin))
Transformation of R colors by simulating color vision deficiencies.
cvdSimulator(col, type = "deuteranope")
cvdSimulator(col, type = "deuteranope")
col |
character. A vector of colors. |
type |
Deficiency type, "protanope" or "deuteranope" |
Here use Vienot's methods but not Gustavo's methods (implemented in colorspace::simulate_cvd).
colors.
Vienot, F., Brettel, H. and Mollon, J.D. (1999) <doi:10.1002/(SICI)1520-6378(199908)24:4 Sharma, G., Wu, W. and Dalal, E.N. (2005) <doi:10.1002/col.20070>
cvdSimulator(safeColors)
cvdSimulator(safeColors)
Display all the available color palettes.
displayAvailablePalette(...)
displayAvailablePalette(...)
... |
parameters could be used by geom_tile. |
an ggplot object
displayAvailablePalette()
displayAvailablePalette()
Display the given colors
displayColors(col, ...) displayAllColors(col, types = c("deuteranope", "protanope", "desaturate"), ...)
displayColors(col, ...) displayAllColors(col, types = c("deuteranope", "protanope", "desaturate"), ...)
col |
color set to display |
... |
parameters could be used by geom_tile. |
types |
the type of color vision deficiency. |
an ggplot object
displayColors(safeColors) displayColors(paletteMartin) displayAllColors(safeColors, color="white") displayAllColors(paletteMartin, color="white")
displayColors(safeColors) displayColors(paletteMartin) displayAllColors(safeColors, color="white") displayAllColors(paletteMartin, color="white")
use grid.grabExpr or plot_to_gtable to convert plot to grob
grobify(plot)
grobify(plot)
plot |
plots |
grob object.
The palette could be used for heatmap or pie graph
paletteMartin Green2Magenta16Steps Blue2DarkRed12Steps Blue2DarkRed18Steps Blue2OrangeRed14Steps Blue2DarkOrange12Steps Blue2DarkOrange18Steps Blue2Green14Steps Brown2Blue10Steps Brown2Blue12Steps Blue2Gray8Steps Blue2Orange8Steps Blue2Orange10Steps Blue2Orange12Steps ModifiedSpectralScheme11Steps LightBlue2DarkBlue7Steps LightBlue2DarkBlue10Steps PairedColor12Steps SteppedSequential5Steps
paletteMartin Green2Magenta16Steps Blue2DarkRed12Steps Blue2DarkRed18Steps Blue2OrangeRed14Steps Blue2DarkOrange12Steps Blue2DarkOrange18Steps Blue2Green14Steps Brown2Blue10Steps Brown2Blue12Steps Blue2Gray8Steps Blue2Orange8Steps Blue2Orange10Steps Blue2Orange12Steps ModifiedSpectralScheme11Steps LightBlue2DarkBlue7Steps LightBlue2DarkBlue10Steps PairedColor12Steps SteppedSequential5Steps
An object of class character
of length 15.
An object of class character
of length 16.
An object of class character
of length 12.
An object of class character
of length 18.
An object of class character
of length 14.
An object of class character
of length 12.
An object of class character
of length 18.
An object of class character
of length 14.
An object of class character
of length 10.
An object of class character
of length 12.
An object of class character
of length 8.
An object of class character
of length 8.
An object of class character
of length 10.
An object of class character
of length 12.
An object of class character
of length 11.
An object of class character
of length 7.
An object of class character
of length 10.
An object of class character
of length 12.
An object of class character
of length 25.
The names of the palette is approximal color name.
Green2Magenta16Steps: Useful for generic diverging data.
Blue2DarkRed12/18Steps: Useful for temperature-like data, with a subjective interpretation (blue=cold, red=hot) Blue2OrangeRed14Steps: Useful as an alternative to the red/blue temperature scale.
Blue2DarkOrange12/18Steps: Useful for data without a specific subjective color association.
Blue2Green14Steps: Useful for data with a winter (blue) vs. summer (green) association.
Brown2Blue10/12Steps: Useful for data with a dry (brown) vs. wet (blue) association.
Blue2Gray8Steps: Useful in particular for diverging data like cloudiness anomalies.
Blue2Orange8/10/12Steps: Useful for data like sea-level pressure, with ansubjective association (blue=low, wet, orange=high, dry)
ModifiedSpectralScheme11Steps: An alternative to the spectral scheme (no green)
LightBlue2DarkBlue7/10Steps: Useful for precipitation-like data.
PairedColor12Steps: Attempt at a categorical color scale with colors that may be distinguishable to all viewers
SteppedSequential5Steps: Useful for portraying levels-within-categories
<http://mkweb.bcgsc.ca/biovis2012/>
Light A, Bartlein PJ (2004). "The End of the Rainbow? Color Schemes for Improved Data Graphics." EOS Transactions of the American Geophysical Union, 85(40), 385.
paletteMartin Green2Magenta16Steps Blue2DarkRed12Steps Blue2DarkRed18Steps Blue2OrangeRed14Steps Blue2DarkOrange12Steps Blue2DarkOrange18Steps Blue2Green14Steps Brown2Blue10Steps Brown2Blue12Steps Blue2Gray8Steps Blue2Orange8Steps Blue2Orange10Steps Blue2Orange12Steps ModifiedSpectralScheme11Steps LightBlue2DarkBlue7Steps LightBlue2DarkBlue10Steps PairedColor12Steps SteppedSequential5Steps
paletteMartin Green2Magenta16Steps Blue2DarkRed12Steps Blue2DarkRed18Steps Blue2OrangeRed14Steps Blue2DarkOrange12Steps Blue2DarkOrange18Steps Blue2Green14Steps Brown2Blue10Steps Brown2Blue12Steps Blue2Gray8Steps Blue2Orange8Steps Blue2Orange10Steps Blue2Orange12Steps ModifiedSpectralScheme11Steps LightBlue2DarkBlue7Steps LightBlue2DarkBlue10Steps PairedColor12Steps SteppedSequential5Steps
replace the colors of plots to meet the requirment of publication. Replacing red with magenta or green with turquoise. Replacing all the colored symbols in the legend.
replacePlotColor(plot)
replacePlotColor(plot)
plot |
The grob to be plotted. |
an object of gtable.
replacePlotColor(displayColors(c("Red", "Green", "blue")))
replacePlotColor(displayColors(c("Red", "Green", "blue")))
Set the pdf width and height for journals.
Pre-sets of width for figures.
setPDFopt( width = c("1col", "1.5col", "0.5col", "2col"), presets = PRESETS$science ) PRESETS
setPDFopt( width = c("1col", "1.5col", "0.5col", "2col"), presets = PRESETS$science ) PRESETS
width |
columns. |
presets |
The pre-setting of width,height,family,font for pdf. Available choices: 0.5col, 1col, 1.5col, 2col. |
An object of class list
of length 4.
The family will be Helvetica. The font will be 8. The width and height will be same.
science: 0.5col=1.78 inches (4.52 cm.); 1col=3.54 inches (9 cm.); 1.5col=5 inches (12.7 cm.); 2col=7.25 inches (18.4 cm.). nature: 0.5col=2.28 inches (5.8 cm.); 1col=3.39 inches (8.6 cm.); 1.5col=4.76 inches (12.1 cm.); 2col=7 inches (17.8 cm.). cell: 0.5col=1.78 inches (4.52 cm.); 1col=3.35 inches (8.5 cm.); 1.5col=4.49 inches (11.4 cm.); 2col=6.85 inches (17.4 cm.). CA: A Cancer Journal for Clinicians 0.5col=1.62 inches (4.1 cm.); 1col=3.25 inches (8.25 cm.); 1.5col=3.87 inches (9.8 cm.); 2col=6.75 inches (17.1 cm.).
A named list of all the defaults. If any arguments are supplied the return values are the old values and the result has the visibility flag turned off.
<http://www.sciencemag.org/sites/default/files/Figure_prep_guide.pdf>
<https://images.nature.com/full/nature-assets/aj/artworkguidelines.pdf>
op <- setPDFopt("1col")
op <- setPDFopt("1col")