Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

smoothColors

Build a vector of color values


Description

smoothColors calculates a sequence of colors. If two color names in the arguments are separated by a number, that number of interpolated colors will be inserted between the two color endpoints. Any number of color names and integers may be passed, but the last argument must be a color name. If more than one integer appears between two color names, only the first will be used in the interpolation and the others will be ignored.

Usage

smoothColors(...,alpha=NA)

Arguments

...

an arbitrary sequence of color names and integers beginning and ending with a color name.

alpha

optional alpha (transparency) value.

Value

A vector of hexadecimal color values as used by col.

Note

For more R functions that transform numeric values into colors or produce colors that can be used to represent values, see the colourschemes package.

Author(s)

Barry Rowlingson

See Also

Examples

plot(1:10,main="Test opaque colors",type="n",axes=FALSE)
 box()
 rect(1:7,1:7,3:9,3:9,col=smoothColors("red",2,"green",2,"blue"))

plotrix

Various Plotting Functions

v3.8-1
GPL (>= 2)
Authors
Jim Lemon, Ben Bolker, Sander Oom, Eduardo Klein, Barry Rowlingson, Hadley Wickham, Anupam Tyagi, Olivier Eterradossi, Gabor Grothendieck, Michael Toews, John Kane, Rolf Turner, Carl Witthoft, Julian Stander, Thomas Petzoldt, Remko Duursma, Elisa Biancotto, Ofir Levy, Christophe Dutang, Peter Solymos, Robby Engelmann, Michael Hecker, Felix Steinbeck, Hans Borchers, Henrik Singmann, Ted Toal, Derek Ogle, Darshan Baral, Ulrike Groemping, Bill Venables
Initial release
2021-01-21

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.