[R] heatmap.2 no reordering of the columns and rows

James W. MacDonald jmacdon at med.umich.edu
Tue Apr 7 15:02:14 CEST 2009


Hi Tanuja,

Tanuja Bompada wrote:
> Hi,
>   I need to generate a heatmap on a square matrix and wouldn't want to reorder the columns and the rows on the heatmap display.  
>   I have used the options Rowv=NULL and Colv=NULL but doesn't seem to work. Following is a snippet of the heatmap function i am using.
> 
> args <- commandArgs();
> inputfile <- args[2]
> imgfile   <- args[3]
> 
> bitmap(imgfile, height=15, width=15, res=100, pointsize=9)
> 
> library(gplots)
> library(RColorBrewer)
> data <- read.table(inputfile)
> matrix <- as.matrix(data)
> cp <- colorRampPalette(c("red","yellow","darkgreen"),space="Lab", bias=1.5)
> heatmap.2(matrix, Colv=1:ncol(matrix), dendogram="row", hclustfun=function(m) hclust(m,method="complete"),col=cp(25),scale="none",trace="none",keysize=1,margins=c(5,12), cexCol=1, cexRow=1)
> q()
> dev.off()
> 
> The alternative that i tried to avoid the reordering was 
> 
> heatmap.2(matrix, Rowv=NULL, Colv=NULL, col=cp(25), scale="none", trace="none", keysize=1, margins=c(5,12), cexCol=1, cexRow=1)

Try using Rowv = FALSE, Colv = FALSE instead of NULL. Also, add 
dendrogram = "none".

Best,

Jim


> 
> But the above command doesnt generate the heatmap. So could anyone let me know what are the options to avoid reordering the rows and columns of the heatmap and i dont want the dendogram. I am using the R version 2.8.0 (2008-10-20)".
> 
> Thanks,
> Tanuja
> 
> 
> 
> 
>       
> 	[[alternative HTML version deleted]]
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
James W. MacDonald, M.S.
Biostatistician
Douglas Lab
University of Michigan
Department of Human Genetics
5912 Buhl
1241 E. Catherine St.
Ann Arbor MI 48109-5618
734-615-7826




More information about the R-help mailing list