R Language Color schemes for graphics basic R color functions


Example

Function colors() lists all the color names that are recognized by R. There is a nice PDF where one can actually see those colors.


colorRampPalette creates a function that interpolate a set of given colors to create new color palettes. This output function takes n (number) as input and produces a color vector of length n interpolating the initial colors.

pal <- colorRampPalette(c('white','red'))
pal(5)
[1] "#FFFFFF" "#FFBFBF" "#FF7F7F" "#FF3F3F" "#FF0000"

Any specific color may be produced with an rgb() function:

rgb(0,1,0)

produces green color.