Using the heatmap.2 function, I am trying to generate a heatmap of a 2 column x 500 row matrix of numeric values. I would like the 1st column of the matrix sorted from the highest to the lowest values - so that the colors reflected in the first column of the heatmap (top to bottom) go from red to green. After sorting the matrix (z), I tried the following command, but the data remains clustered. heatmap.2((z),col=greenred(100),dendrogram=NULL,Rowv=FALSE) I also tried the following, but the data remained clustered. heatmap.2((z),col=greenred(100),Colv=1:ncol(z)) ANY IDEAS?? Thanks so much, Peter
Dear Peter, heatmap.2(z, dendrogram = "none", Rowv = FALSE, Colv = FALSE) should do what you want. Best, Matthias Peter Scacheri wrote:> Using the heatmap.2 function, I am trying to generate a heatmap of a 2 > column x 500 row matrix of numeric values. I would like the 1st > column of the matrix sorted from the highest to the lowest values - so > that the colors reflected in the first column of the heatmap (top to > bottom) go from red to green. > > After sorting the matrix (z), I tried the following command, but the > data remains clustered. > > heatmap.2((z),col=greenred(100),dendrogram=NULL,Rowv=FALSE) > > I also tried the following, but the data remained clustered. > > heatmap.2((z),col=greenred(100),Colv=1:ncol(z)) > > ANY IDEAS?? > Thanks so much, > Peter > > ______________________________________________ > 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.-- Dr. Matthias Kohl www.stamats.de
heatmap.2(z, col = greenred(100), dendrogram = "none", Rowv = FALSE) NULL isn't one of the accepted values for the dendrogram argument. See ?heatmap.2 Best, Jim Peter Scacheri wrote:> Using the heatmap.2 function, I am trying to generate a heatmap of a 2 > column x 500 row matrix of numeric values. I would like the 1st column > of the matrix sorted from the highest to the lowest values - so that the > colors reflected in the first column of the heatmap (top to bottom) go > from red to green. > > After sorting the matrix (z), I tried the following command, but the > data remains clustered. > > heatmap.2((z),col=greenred(100),dendrogram=NULL,Rowv=FALSE) > > I also tried the following, but the data remained clustered. > > heatmap.2((z),col=greenred(100),Colv=1:ncol(z)) > > ANY IDEAS?? > Thanks so much, > Peter > > ______________________________________________ > 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 Affymetrix and cDNA Microarray Core University of Michigan Cancer Center 1500 E. Medical Center Drive 7410 CCGC Ann Arbor MI 48109 734-647-5623
Thanks Matthias, I tried that, but received the following error message: Error in image.default(1:nc, 1:nr, x, xlim = 0.5 + c(0, nc), ylim = 0.5 + : dimensions of z are not length(x)(+1) times length(y)(+1) -Peter At 10:18 AM +0200 5/15/08, Matthias Kohl wrote:>Dear Peter, > >heatmap.2(z, dendrogram = "none", Rowv = FALSE, Colv = FALSE) > >should do what you want. > >Best, >Matthias > >Peter Scacheri wrote: >>Using the heatmap.2 function, I am trying to generate a heatmap of >>a 2 column x 500 row matrix of numeric values. I would like the >>1st column of the matrix sorted from the highest to the lowest >>values - so that the colors reflected in the first column of the >>heatmap (top to bottom) go from red to green. >> >>After sorting the matrix (z), I tried the following command, but >>the data remains clustered. >> >>heatmap.2((z),col=greenred(100),dendrogram=NULL,Rowv=FALSE) >> >>I also tried the following, but the data remained clustered. >> >>heatmap.2((z),col=greenred(100),Colv=1:ncol(z)) >> >>ANY IDEAS?? >>Thanks so much, >>Peter >> >>______________________________________________ >>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. > >-- >Dr. Matthias Kohl >www.stamats.de
Dear Peter, the call works for me; e.g. x <- matrix(rnorm(100), ncol = 4) heatmap.2(x, dendrogram="none", Colv = FALSE, Rowv = FALSE) There seems to be something wrong with your matrix z ... Best, Matthias Peter Scacheri wrote:> Thanks Matthias, > > I tried that, but received the following error message: > > Error in image.default(1:nc, 1:nr, x, xlim = 0.5 + c(0, nc), ylim = > 0.5 + : > dimensions of z are not length(x)(+1) times length(y)(+1) > > > -Peter > > At 10:18 AM +0200 5/15/08, Matthias Kohl wrote: >> Dear Peter, >> >> heatmap.2(z, dendrogram = "none", Rowv = FALSE, Colv = FALSE) >> >> should do what you want. >> >> Best, >> Matthias >> >> Peter Scacheri wrote: >>> Using the heatmap.2 function, I am trying to generate a heatmap of a >>> 2 column x 500 row matrix of numeric values. I would like the 1st >>> column of the matrix sorted from the highest to the lowest values - >>> so that the colors reflected in the first column of the heatmap (top >>> to bottom) go from red to green. >>> >>> After sorting the matrix (z), I tried the following command, but the >>> data remains clustered. >>> >>> heatmap.2((z),col=greenred(100),dendrogram=NULL,Rowv=FALSE) >>> >>> I also tried the following, but the data remained clustered. >>> >>> heatmap.2((z),col=greenred(100),Colv=1:ncol(z)) >>> >>> ANY IDEAS?? >>> Thanks so much, >>> Peter >>> >>> ______________________________________________ >>> 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. >> >> -- >> Dr. Matthias Kohl >> www.stamats.de > > ______________________________________________ > 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.-- Dr. Matthias Kohl www.stamats.de