R Language basic R color functions


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'))
[1] "#FFFFFF" "#FFBFBF" "#FF7F7F" "#FF3F3F" "#FF0000"

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


produces green color.