Re: [R] red-black-green color palette?

From: Earl F. Glynn <efg_at_stowers-institute.org>
Date: Fri 05 Aug 2005 - 01:21:06 EST

"Jake Michaelson" <jjmichael@comcast.net> wrote in message news:cbc7a1be7e3c68c0ccac507be8d3e7d8@comcast.net...
> 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

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Fri Aug 05 01:31:11 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 15:04:14 EST