bioinformatics_guy
2009-Sep-17 12:23 UTC
[R] heatmap.2() problems with re-ordering of rows and columns
I have a file of the following form -11 -10 -9 -8 -10 -9 -8 NA -9 -7 NA NA -8 NA NA NA So basically a NxN matrix of log scores. I want to get a heatmap of these log scores but I'm having a problem. I'm using the following code library(gplots) data=read.table("filein.txt",header=FALSE) mat=as.matrix(data) heatmap.2(mat,dendrogram=c("none")) But on the picture, it rearranges all my row,columns. I want it the y axis to be labeled from [10,-10] and the x axis to be the same [-10,10] so that the bottom left cell is -10,-10 and the top right cell is 10,10 -- which is the way the matrix is laid out. Why is it rearranging my cells? -- View this message in context: http://www.nabble.com/heatmap.2%28%29-problems-with-re-ordering-of-rows-and-columns-tp25490249p25490249.html Sent from the R help mailing list archive at Nabble.com.
Schalk Heunis
2009-Sep-17 13:23 UTC
[R] heatmap.2() problems with re-ordering of rows and columns
Hi bioinformatics_guy I think you are looking for the "image" function: image(mat) The heatmap.2 function does hierarchical clustering on rows and columns and then orders the rows and columns according to the results of the clustering. Image simply plots the matrix. HTH Schalk Heunis On Thu, Sep 17, 2009 at 2:23 PM, bioinformatics_guy <wwwhitener@gmail.com>wrote:> > I have a file of the following form > > -11 -10 -9 -8 > -10 -9 -8 NA > -9 -7 NA NA > -8 NA NA NA > > So basically a NxN matrix of log scores. I want to get a heatmap of these > log scores but I'm having a problem. > > I'm using the following code > > library(gplots) > data=read.table("filein.txt",header=FALSE) > mat=as.matrix(data) > heatmap.2(mat,dendrogram=c("none")) > > But on the picture, it rearranges all my row,columns. I want it the y axis > to be labeled from [10,-10] and the x axis to be the same [-10,10] so that > the bottom left cell is -10,-10 and the top right cell is 10,10 -- which is > the way the matrix is laid out. Why is it rearranging my cells? > > -- > View this message in context: > http://www.nabble.com/heatmap.2%28%29-problems-with-re-ordering-of-rows-and-columns-tp25490249p25490249.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@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. >[[alternative HTML version deleted]]