"Jake Michaelson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'm working on some heatmaps, and the person I'm working with would
> prefer a red-black-green color palette (red denoting gene induction and
> green denoting gene repression). Does such a palette exist already?
> If not, is there an easy way to create one?
Here are four ways:
showpanel <- function(Colors)
{
image(matrix(1:length(Colors), ncol=1), col=Colors, xaxt="n", yaxt="n" )
}
oldpar <- par(mfrow=c(4,2))
# Method 1 (colorRampPalette was new in R 2.1.0) in grDevices
# Same as function with same name in dichromat package?
showpanel(colorRampPalette( c("green", "black", "red"), space="rgb")(32))
showpanel(colorRampPalette( c("green", "black", "red"), space="rgb")(64))
# Method 2
library(gplots)
showpanel(greenred(32))
showpanel(redgreen(64))
# Method 3
library(geneplotter)
showpanel(greenred.colors(32))
showpanel(greenred.colors(64))
# Method 4
library("marray")
pal <- maPalette(low="green", high="red",mid="black")
maColorBar(seq(-2,2, 0.2), col=pal, horizontal=TRUE, k=0)
maColorBar(seq(-2,2, 0.1), col=pal, horizontal=TRUE, k=0)
efg
--
Earl F. Glynn
Scientific Programmer
Stowers Institute for Medical Research
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html