Christian.Stratowa@vie.boehringer-ingelheim.com
2005-Jul-27 07:54 UTC
[R] Asymmetric colors for heatmap
> Dear expeRts, > > Currently, my colors are as follows: > mycol <- > c("blue1","blue2","blue3","blue4","black","yellow4","yellow3","yellow2","y > ellow1") > 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? > > (P.S.: Of course, I could do: snp[snp>8] <- 8, but this will not solve my > problem with asymmetric colors) > > Thank you in advance > Christian Stratowa > > > > > >
[R] Asymmetric colors for heatmapSee the breaks argument to heatmap. Sean ----- Original Message ----- From: Christian.Stratowa@vie.boehringer-ingelheim.com To: r-help@stat.math.ethz.ch Sent: Wednesday, July 27, 2005 3:54 AM Subject: [R] Asymmetric colors for heatmap > Dear expeRts, > > Currently, my colors are as follows: > mycol <- > c("blue1","blue2","blue3","blue4","black","yellow4","yellow3","yellow2","y > ellow1") > 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? > > (P.S.: Of course, I could do: snp[snp>8] <- 8, but this will not solve my > problem with asymmetric colors) > > Thank you in advance > Christian Stratowa > > > > > > ______________________________________________ R-help@stat.math.ethz.ch mailing list stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! R-project.org/posting-guide.html [[alternative HTML version deleted]]
Christian.Stratowa@vie.boehringer-ingelheim.com
2005-Jul-27 12:06 UTC
[R] Asymmetric colors for heatmap
Dear Sean Thank you, however the heatmap() function from the stats package does not have this option. Browsing around I see that you mean heatmap.2() from package gplots, which we have not installed yet. Is there also another possibility besides heatmap.2() since I would also need this option for e.g. function image(). Best regards Christian -----Original Message----- From: Sean Davis [mailto:sdavis2@mail.nih.gov] Sent: Wednesday, July 27, 2005 13:16 To: Christian.Stratowa@vie.boehringer-ingelheim.com; r-help@stat.math.ethz.ch Subject: Re: [R] Asymmetric colors for heatmap See the breaks argument to heatmap. Sean ----- Original Message ----- From: Christian.Stratowa@vie.boehringer-ingelheim.com <mailto:Christian.Stratowa@vie.boehringer-ingelheim.com> To: r-help@stat.math.ethz.ch <mailto:r-help@stat.math.ethz.ch> Sent: Wednesday, July 27, 2005 3:54 AM Subject: [R] Asymmetric colors for heatmap> Dear expeRts, > > Currently, my colors are as follows: > mycol <- > c("blue1","blue2","blue3","blue4","black","yellow4","yellow3","yellow2","y> ellow1") > 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? > > (P.S.: Of course, I could do: snp[snp>8] <- 8, but this will not solve my > problem with asymmetric colors) > > Thank you in advance > Christian Stratowa > > > > > >______________________________________________ R-help@stat.math.ethz.ch mailing list stat.ethz.ch/mailman/listinfo/r-help <stat.ethz.ch/mailman/listinfo/r-help> PLEASE do read the posting guide! R-project.org/posting-guide.html <R-project.org/posting-guide.html> [[alternative HTML version deleted]]
Christian.Stratowa@vie.boehringer-ingelheim.com
2005-Jul-27 14:13 UTC
[R] Asymmetric colors for heatmap
Sorry, my mistake, I did not realize that image() has breaks and that heatmap() inherits from image(). However, I have the following problem, maybe I am doing something wrong. I have defined: mycol <- c("blue1","blue2","blue3","blue4","black","yellow4","yellow3","yellow2","yel low1") breaks<-c(0,0.5,1,1.5,2,2.5,3,4,5,6) When I call image() then the colors change slightly: image(t(tmp),col=mycol,axes=F) image(t(tmp),col=mycol,axes=F,breaks=breaks) However, when I call heatmap(): heatmap(tmp,Rowv=NA,Colv=NA,col=mycol) heatmap(tmp,Rowv=NA,Colv=NA,col=mycol,breaks=breaks) then breaks results in half of the heatmap drawn in white! Do you know what may be my mistake? Best regards Christian -----Original Message----- From: Stratowa,Dr.,Christian FEX BIG-AT-V Sent: Wednesday, July 27, 2005 14:07 To: 'Sean Davis'; r-help at stat.math.ethz.ch Subject: RE: [R] Asymmetric colors for heatmap Dear Sean Thank you, however the heatmap() function from the stats package does not have this option. Browsing around I see that you mean heatmap.2() from package gplots, which we have not installed yet. Is there also another possibility besides heatmap.2() since I would also need this option for e.g. function image(). Best regards Christian -----Original Message----- From: Sean Davis [mailto:sdavis2 at mail.nih.gov] Sent: Wednesday, July 27, 2005 13:16 To: Christian.Stratowa at vie.boehringer-ingelheim.com; r-help at stat.math.ethz.ch Subject: Re: [R] Asymmetric colors for heatmap See the breaks argument to heatmap. Sean