Dear Sean 
 
Thank you for your useful suggestions, I appreciate it very much and will
try it in addition to heatmap.
 
Meanwhile, I have managed to get breaks to work, here is my example code for
others who might be interested:
 
# test parameter breaks for image and heatmap
m <- matrix(c(1.5, 2.0, 1.5, 2.0, 2.6, 1.4,
              9.5, 2.3, 2.5, 2.0, 0.6, 2.4,
              1.5, 0.5, 7.5, 2.0, 0.6, 2.2,
              2.5, 0.0, 4.5, 2.0, 2.0, 1.8,
              7.5, 0.5, 7.5, 2.0, 5.6, 1.6,
              0.5, 2.0, 1.5, 2.0, 7.6, 2.1,
              1.5, 2.5, 2.0, 2.0, 1.6, 1.4),
              nrow=7, ncol=6, byrow=T)

mycol <-
c("blue1","blue2","blue3","blue4","black","yellow4","yellow3","yellow2","yel
low1")
breaks<-c(0,0.5,1.0,1.4,1.7,2,2.3,4,7,10)

# for image, breaks works ok
image(t(tmp),col=mycol,axes=F)
image(t(tmp),col=mycol,axes=F,breaks=breaks)
# problem with heatmap since default scale=row"
heatmap(tmp,Rowv=NA,Colv=NA,col=mycol)
heatmap(tmp,Rowv=NA,Colv=NA,col=mycol,breaks=breaks)
# need to set scale to scale="none"
heatmap(tmp,Rowv=NA,Colv=NA,col=mycol,scale="none")
heatmap(tmp,Rowv=NA,Colv=NA,col=mycol,scale="none",breaks=breaks)

 
Best regards
Christian

-----Original Message-----
From: Sean Davis [mailto:sdavis2@mail.nih.gov] 
Sent: Friday, July 29, 2005 13:24
To: Christian.Stratowa@vie.boehringer-ingelheim.com; Bioconductor
Subject: Re: [BioC] Asymmetric colors for heatmap


On 7/26/05 3:04 AM, "Christian.Stratowa@vie.boehringer-ingelheim.com"
<Christian.Stratowa@vie.boehringer-ingelheim.com> wrote:



Currently, my colors are as follows: 
mycol <- 
c("blue1","blue2","blue3","blue4","black","yellow4","yellow3","yellow2","yel

low1") 
heatmap(snp, Rowv=NA, Colv=NA, col=mycol) 

However, I would like to have the following colors: 
bright blue -> dark blue: for intensity range from 0 to 2 in  steps of 0.5 
(i.e. 4 grades of blue) 
black:  for intensity 2 
dark yellow -> bright yellow: for intensity range from 2 to 8 in steps of 
0.5 (i.e. 8 grades of yellow) 

You may realize that I want to display copy number data from SNP-chips as 
heatmap. 
Since copynumber = 2, is the default value, I want to display it in black, 
LOH in increasing blue, and amplifications in increasing yellow. 
Even though there may be higher amplification rates, a value of CN=8 should 
already display the brightest yellow. 

In Spotfire it is easy to achieve this, especially that CN=2 is always 
displayed as black, however, I do not know how to do it in R. 
Can you tell me how I have to create the colors to achieve this? 




How about using heatmap.2 (as you suggested yourself in the last email) and
doing something like:

heatmap.2(snp,col=colorRampPalette(c('blue','black','yellow')),breaks=c(seq(
0,1.75,(1.75)/16),2,seq(2.5,8,(8-2.5)/16)),trace='none')

This will provide black in the center and 16 shades of blue along with 16
shades of yellow on either side of black.  You will need the gregmisc
packages, but they are quite useful anyway for genomic-based work (see
wapply, for example).

Hope this helps,
Sean



	[[alternative HTML version deleted]]

