colorpanel {gplots} | R Documentation |
colorpanel
generate a set of colors that varies
smoothly. redgreen
, greenred
, bluered
, and
redblue
generate red-black-green, green-black-red,
red-white-blue, and blue-white-red colorbars, respectively.
colors
colorpanel(n, low, mid, high) redgreen(n) greenred(n) bluered(n) redblue(n)
n |
Desired number of color elements in the panel. |
low, mid, high |
Colors to use for the Lowest, middle, and highest values. |
The values for low, mid, high
can be given as
color names ('red'), plot color index (2=red), and HTML-style RGB,
("#FF0000"=red).
The returned color panel will consist of n - floor(n/2)
HTML-style RGB
elements which vary smoothly between low
and mid
, then
between mid
and high
. Note that if n
is even,
the color mid
will occur twice at the center of the sequence.
Vector of HTML-style RGB colors.
Gregory R. Warnes Gregory_R_Warnes@groton.pfizer.com
showpanel <- function(col) { image(z=matrix(1:100, ncol=1), col=col, xaxt="n", yaxt="n" ) } par(mfrow=c(2,3)) showpanel(colorpanel(8,"red","black","green")) # note the duplicatation of black at the center, using an odd # number of elements resolves this: showpanel(colorpanel(9,"red","black","green")) showpanel(greenred(64)) showpanel(redgreen(64)) showpanel(bluered(64)) showpanel(redblue(64))