addPalette | R Documentation |
addPalette()
: function to manually add a colorpalette for heatmaps to the six heatmap palettes existing inside bactMAP. Use showCurrentPalettes()
to print mockup-heatmap plots with the six default palettes and - if appliccable - the added palettes. Use getPalette(palName)
to get the hex codes for the pallete you use. pal2Default()
sets the color palettes back to default.
addPalette(palList, palName)
showCurrentPalettes()
getPalette(palName)
pal2Default()
palList |
a list consisting of 3 hex color codes (character strings, for instance "#FFFFFF" or "#DD0088") or color names known by R (for instance "red" or "violet"). Optional; if argument is not used, the function will ask for the colors seperately while running. |
palName |
a character string defining the name of the added colorpalette. Optional, if argument not used, the function will ask for the palette name. |
addPalette()
and showCurrentPalettes()
will print heatmap plots using the color palettes loaded into bactMAP. addPalette()
also adds the manually entered color palette to the list of color palettes loaded into the bactMAP environment during the R session.
Renske van Raaphorst
The default color palettes are chosen based on the Color Universal Design (CUD, Masataka Okabe & Kei Ito): http://jfly.iam.u-tokyo.ac.jp/color/
For more information and vast choice of good color palettes for plots, check http://colorbrewer2.org
For a comprehensive list of R color names, check http://www.stat.columbia.edu/~tzheng/files/Rcolor.pdf
##Check the color palettes inside bactMAP
showCurrentPalettes()
##Pick three colors you like and put them in a list -
#in the order of lowest value - midpoint - highest value
listofcolors <- list("orangered", "darkseagreen", "burlywood1")
##Add to the color palettes inside bactMAP
addPalette(listofcolors, "MyBeautifulPalette")
##Get palette hex codes for "GreenYellow"
getPalette("GreenYellow")
##Put color palettes back to default
pal2Default()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.