Type: | Package |
Title: | Safe Color Set for Color Blindness |
Version: | 0.1.9 |
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. |
Depends: | R(≥ 3.6) |
Imports: | ggplot2, grDevices, methods, cowplot, colorspace, graphics, gridGraphics, gtable, grid |
Suggests: | knitr, reshape2, stats, png, markdown, rmarkdown |
biocViews: | Visualization |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
Encoding: | UTF-8 |
VignetteBuilder: | knitr |
RoxygenNote: | 7.1.1 |
NeedsCompilation: | no |
Packaged: | 2021-04-17 01:32:27 UTC; jianhongou |
Author: | Jianhong Ou |
Maintainer: | Jianhong Ou <jianhong.ou@duke.edu> |
Repository: | CRAN |
Date/Publication: | 2021-04-17 04:50:05 UTC |
safe colors
Description
color blindness safe colors
Usage
BLACK
ORANGE
SKY_BLUE
BLUISH_GREEN
YELLOW
BLUE
VERMILLION
REDDISH_PURPLE
safeColors
Format
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.
References
Wong, B. (2011) <doi:10.1038/nmeth.1642> Wong, B. (2011) <doi:10.1038/nmeth.1618>
Examples
safeColors
available colors
Description
export available colors
Usage
availableColors()
Value
a character vector contain safe colors.
Examples
availableColors()
Available color palette
Description
List all the available color palettes.
Usage
availablePalette()
Value
a character vector contain available color palettes.
Examples
availablePalette()
available color variable
Description
export available color names
Usage
colorNames()
Value
a character vector contain safe colors.
Examples
colorNames()
Show color-deficiency simulations of a plot
Description
Plot the color-deficiency simulations for ggplot grob.
Usage
cvdPlot(
plot = last_plot(),
layout = c("origin", "deuteranope", "protanope", "desaturate")
)
Arguments
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. |
Details
This function is modified from <https://github.com/clauswilke/colorblindr>
Value
An object of ggplot.
Examples
cvdPlot(displayColors(safeColors))
cvdPlot(displayColors(paletteMartin))
simulate color vision deficiency
Description
Transformation of R colors by simulating color vision deficiencies.
Usage
cvdSimulator(col, type = "deuteranope")
Arguments
col |
character. A vector of colors. |
type |
Deficiency type, "protanope" or "deuteranope" |
Details
Here use Vienot's methods but not Gustavo's methods (implemented in colorspace::simulate_cvd).
Value
colors.
References
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>
Examples
cvdSimulator(safeColors)
Display available palette
Description
Display all the available color palettes.
Usage
displayAvailablePalette(...)
Arguments
... |
parameters could be used by geom_tile. |
Value
an ggplot object
Examples
displayAvailablePalette()
display colors
Description
Display the given colors
Usage
displayColors(col, ...)
displayAllColors(col, types = c("deuteranope", "protanope", "desaturate"), ...)
Arguments
col |
color set to display |
... |
parameters could be used by geom_tile. |
types |
the type of color vision deficiency. |
Value
an ggplot object
Examples
displayColors(safeColors)
displayColors(paletteMartin)
displayAllColors(safeColors, color="white")
displayAllColors(paletteMartin, color="white")
convert plot to grob
Description
use grid.grabExpr or plot_to_gtable to convert plot to grob
Usage
grobify(plot)
Arguments
plot |
plots |
Value
grob object.
Palette for color blindness
Description
The palette could be used for heatmap or pie graph
Usage
paletteMartin
Green2Magenta16Steps
Blue2DarkRed12Steps
Blue2DarkRed18Steps
Blue2OrangeRed14Steps
Blue2DarkOrange12Steps
Blue2DarkOrange18Steps
Blue2Green14Steps
Brown2Blue10Steps
Brown2Blue12Steps
Blue2Gray8Steps
Blue2Orange8Steps
Blue2Orange10Steps
Blue2Orange12Steps
ModifiedSpectralScheme11Steps
LightBlue2DarkBlue7Steps
LightBlue2DarkBlue10Steps
PairedColor12Steps
SteppedSequential5Steps
Format
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.
Details
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
Source
<http://mkweb.bcgsc.ca/biovis2012/>
References
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.
Examples
paletteMartin
Green2Magenta16Steps
Blue2DarkRed12Steps
Blue2DarkRed18Steps
Blue2OrangeRed14Steps
Blue2DarkOrange12Steps
Blue2DarkOrange18Steps
Blue2Green14Steps
Brown2Blue10Steps
Brown2Blue12Steps
Blue2Gray8Steps
Blue2Orange8Steps
Blue2Orange10Steps
Blue2Orange12Steps
ModifiedSpectralScheme11Steps
LightBlue2DarkBlue7Steps
LightBlue2DarkBlue10Steps
PairedColor12Steps
SteppedSequential5Steps
replace the colors for plots
Description
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.
Usage
replacePlotColor(plot)
Arguments
plot |
The grob to be plotted. |
Value
an object of gtable.
Examples
replacePlotColor(displayColors(c("Red", "Green", "blue")))
Auxiliary funciton to set width of pdf for journals
Description
Set the pdf width and height for journals.
Pre-sets of width for figures.
Usage
setPDFopt(
width = c("1col", "1.5col", "0.5col", "2col"),
presets = PRESETS$science
)
PRESETS
Arguments
width |
columns. |
presets |
The pre-setting of width,height,family,font for pdf. Available choices: 0.5col, 1col, 1.5col, 2col. |
Format
An object of class list
of length 4.
Details
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.).
Value
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.
References
<http://www.sciencemag.org/sites/default/files/Figure_prep_guide.pdf>
<https://images.nature.com/full/nature-assets/aj/artworkguidelines.pdf>
Examples
op <- setPDFopt("1col")