[R] Heatmap clustering
I have constructed a heatmap comparing distances between 30 elements. I get the heatmap plot with red dots when distance is close, and yellow when two elements differ. My question is...how can I get clusters of similarity from the headplot (I don´t know the total number of clusters, otherwise I´d have used Kmeans)? Lots of thanks in advance! Adrià __ R-help@stat.math.ethz.ch 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.
[R] heatmap and phylogram / dendogram ploting problem
Hi, I have trouble with the heatmap function (package stats). The row labels are wrongly ordered and don't correspond to the Rowv dendrogram. I know there is a bug with the heatmap fonction. Emmanuel Paradis (http://tolstoy.newcastle.edu.au/R/e2/help/07/05/16227.html )suggested a modification to fix it but in my case the row labels are still wrongly ordered. Heatmaps with 2 phylograms have been published in different papers, so a solution exists to fix this bug. Could anyone help me ? [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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.
[R] heatmap color still a spectrum for binary outcomes?
I have a matrix of a time series binary response variable for around 200 individuals I would like to display. I am approaching success using the heatmap function in the stats package without dendorgrams, however, am running into trouble in that the colors get lighter with more positive outcomes in a column (time point). Is there a way to make the colors uniform irrespective of the number of similar values in the column? or this part of the heatmap function? Other suggestions for representing the data graphically are certainly welcome as well. Thanks, Patrick [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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.
Re: [R] heatmap and phylogram / dendogram ploting problem, ape package
Emmanuel Paradis, the maintainer of the ape package was very helpful in solving this problem. It seems that it heatmap does not reorder the rows, so you must reorder them or change the heatmap code to do so. The heatmap maintainers will document this, but not change the behavior. The following fix works for me: On 4/30/07, Emmanuel wrote: . . . Thanks for your interesting case study. I found out that, apparently, your problem comes from a bug in heatmap: it assumes that the row names of the matrix are in the same order than the labels of the dendrogram. In your case, the following fix seems to work. You have to edit heatmap with fix(heatmap), find the line: x - x[rowInd, colInd] and change it for: x - x[labels(ddr)[rowInd], colInd] I think this will not solve the problem in all cases. . . On 4/24/07, jamesrh [EMAIL PROTECTED] wrote: I am having trouble displaying a dendrogram of evolutionary relationships (a phylogram imported from the ape package) as the vertical component of a heatmap, but keeping the hierarchical clustering of the horizontal component. The relationships of the vertical component in the generated heatmap are not that of the dendrogram, although the ordering is. In more detail, I am attempting to generate a heatmap from a table that contains the abundance of different bacteria at different locations, with a dendrogram that groups the environments by the pattern of bacterial abundance. This is easy, thanks to a nice code snippet at the R Graph Gallery (http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=66): env - read.table(env.dat) x - as.matrix(env) hv - heatmap(x, col = cm.colors(256), scale=none, xlab = Environments, ylab= Species, main = heatmap of species present in environments) However, instead of a dendrogram that groups the rows (vertical axis) by the abundance pattern (as above), I would like to force it to order and display a dendrogram indicating their evolutionary relatedness. I am using the excellent ape package (http://cran.r-project.org/src/contrib/Descriptions/ape.html) to import the evolutionary dendrograms. I have already manipulated the dendrogram to be ultrameric, with branches all the same length, to prevent an error, although I would prefer not to have to do so: library(ape) mytree - read.tree(file = ultra.newick, text = NULL, tree.names = NULL, skip = 0, comment.char = #) #I then change them into a hclust: tree - as.hclust(mytree) #and make this into a dendrogram dend - as.dendrogram(tree) However, when I use this dendrogram as part of the heatmap, the relationships in the dendrogram that I'm loading are not preserved, although the order of bacteria in the heatmap changes: hv - heatmap(x, col = cm.colors(256), scale=none, Rowv=dend, keep.dendro=TRUE, xlab = Environments, ylab= Species, main = heatmap of species present in environments) Is there something obvious I am missing? When I plot the hclust and dendrogram, they seem to preserve the relationships that I am attempting to show, but not when the dendrogram is used in the heatmap. I'm not sure I really understand the datatype of R dendrogram objects, and this may be the source of my problems. The heatmap documentation (http://addictedtor.free.fr/graphiques/help/index.html?pack=statsalias=h eatmapfun=heatmap.html) is somewhat opaque to someone with my programing skills. Would it be better to reorder the heatmap and then somehow add in the dendrogram with add.expr command? If anyone could suggest something, or point me in the right direction I would greatly appreciate it. jamesh Here are the contents of the two files used as examples above: env.dat: soil1 soil2 soil3 marine1 marine2 marine3 One 23 24 26 0 0 0 Two 43 43 43 3 6 8 Three 56 78 45 23 45 56 Four 6 6 3 34 56 34 Five 2 17 12 76 45 65 ultra.newick: (((One:1,Four:1):1,(Three:1,Two:1):1):1,Five:3):0.0; __ R-help@stat.math.ethz.ch 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.
[R] heatmap and phylogram / dendogram ploting problem, ape package
I am having trouble displaying a dendrogram of evolutionary relationships (a phylogram imported from the ape package) as the vertical component of a heatmap, but keeping the hierarchical clustering of the horizontal component. The relationships of the vertical component in the generated heatmap are not that of the dendrogram, although the ordering is. In more detail, I am attempting to generate a heatmap from a table that contains the abundance of different bacteria at different locations, with a dendrogram that groups the environments by the pattern of bacterial abundance. This is easy, thanks to a nice code snippet at the R Graph Gallery (http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=66): env - read.table(env.dat) x - as.matrix(env) hv - heatmap(x, col = cm.colors(256), scale=none, xlab = Environments, ylab= Species, main = heatmap of species present in environments) However, instead of a dendrogram that groups the rows (vertical axis) by the abundance pattern (as above), I would like to force it to order and display a dendrogram indicating their evolutionary relatedness. I am using the excellent ape package (http://cran.r-project.org/src/contrib/Descriptions/ape.html) to import the evolutionary dendrograms. I have already manipulated the dendrogram to be ultrameric, with branches all the same length, to prevent an error, although I would prefer not to have to do so: library(ape) mytree - read.tree(file = ultra.newick, text = NULL, tree.names = NULL, skip = 0, comment.char = #) #I then change them into a hclust: tree - as.hclust(mytree) #and make this into a dendrogram dend - as.dendrogram(tree) However, when I use this dendrogram as part of the heatmap, the relationships in the dendrogram that I'm loading are not preserved, although the order of bacteria in the heatmap changes: hv - heatmap(x, col = cm.colors(256), scale=none, Rowv=dend, keep.dendro=TRUE, xlab = Environments, ylab= Species, main = heatmap of species present in environments) Is there something obvious I am missing? When I plot the hclust and dendrogram, they seem to preserve the relationships that I am attempting to show, but not when the dendrogram is used in the heatmap. I'm not sure I really understand the datatype of R dendrogram objects, and this may be the source of my problems. The heatmap documentation (http://addictedtor.free.fr/graphiques/help/index.html?pack=statsalias=heatmapfun=heatmap.html) is somewhat opaque to someone with my programing skills. Would it be better to reorder the heatmap and then somehow add in the dendrogram with add.expr command? If anyone could suggest something, or point me in the right direction I would greatly appreciate it. jamesh Here are the contents of the two files used as examples above: env.dat: soil1 soil2 soil3 marine1 marine2 marine3 One 23 24 26 0 0 0 Two 43 43 43 3 6 8 Three 56 78 45 23 45 56 Four 6 6 3 34 56 34 Five 2 17 12 76 45 65 ultra.newick: (((One:1,Four:1):1,(Three:1,Two:1):1):1,Five:3):0.0; __ R-help@stat.math.ethz.ch 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.
[R] heatmap
Hello sir; I use the function heatmap.2 to draw a heatmap of microarray data,which consists of logratios. Q1 But the lengend shows the Z score and the corresponding color.But I want the legend to show the logratios and the corresponding color.How can I do it? Q1 How can I control that cluster only applied to genes(rows) or samples(columns) via heatmap.2 function?Default is cluster applied to both rows and columns. Thanks a lot! My best! __ R-help@stat.math.ethz.ch 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.
[R] heatmap row cell size
Hello all- I am having trouble with the cell sizes that heatmap defaults too. I have a matrix of 160 rows and 5 columns that I am trying to display with heatmap(). When I do this, the cells default to really wide and very short. This makes the labels for the rows very hard to read, in fact the only way I can read them is to make the jpeg output very large and zoom in, and even then it's hard to read and the cells are so wide that you can't see the dendrogram while seeing the labels. I would like to try to have a tall, skinny heatmap with row labels big enough to read. I was able to get closer to what I want with this command... jpeg(file = view_heat.jpg,width = 4000, height = 6000) heatmap(elmat,col= brewer.pal(9,PuOr), cexCol = .8, margin = c(.01,130)) # dev.off() but it only uses a quarter of the jpeg and it is still really hard to see both the dendrogram on the left and read the labels on the right. Is there a way I can set the actual width and height of the cells so I can use the full size of the jpeg and read my labels? thanks in advance Ivan [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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.
Re: [R] heatmap color specification
Jim Lemon wrote: Xiaohui wrote: ... Then, I did a heatmap for 'test' matrix. But for now, I want to specify each of the cell in the heatmap according to the values of the corresponding matrix elements of test. Let's say: col-c(red,yellow,green) for test[1,1], the color on the map should be red. I have tried par('usr') and par('mar') with rect function. But this does not work because the rect shift from the original map. Could any one tell me how to fill the cells on the map with corresponding values? Or can we get the actual coordinates of the image excluding the dendregram. Hi Xiaohui, You may be looking for something like color2D.matplot in the plotrix package or image in the graphics package. Jim Thanks, Jim. I found this problem can be solve with the 'scale' parameter specified to FALSE. If it is TRUE, then the positive integer is scale to a real number which will cause the problem earlier. Xiaohui __ R-help@stat.math.ethz.ch 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.
Re: [R] heatmap color specification
Xiaohui wrote: ... Then, I did a heatmap for 'test' matrix. But for now, I want to specify each of the cell in the heatmap according to the values of the corresponding matrix elements of test. Let's say: col-c(red,yellow,green) for test[1,1], the color on the map should be red. I have tried par('usr') and par('mar') with rect function. But this does not work because the rect shift from the original map. Could any one tell me how to fill the cells on the map with corresponding values? Or can we get the actual coordinates of the image excluding the dendregram. Hi Xiaohui, You may be looking for something like color2D.matplot in the plotrix package or image in the graphics package. Jim __ R-help@stat.math.ethz.ch 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.
[R] heatmap color specification
hi, I have a positive integer matrix like: test-matrix(c(1,2,2,2,2,1,1,2,3),3) and based on the distant function I made like this: generateDistMat-function (target) { n - nrow(target) rn - rownames(target) distM - matrix(NA, n, n) diag(distM) - 0 for (i in 1:(n - 1)) for (j in (i + 1):n) { distM[i, j] - length(which(target[i, ] != target[j, ])) distM[j, i] - distM[i, j] } colnames(distM) - rownames(distM) - rn distM } dist.fun - function(M) return(as.dist(generateDistMat(M))) Then, I did a heatmap for 'test' matrix. But for now, I want to specify each of the cell in the heatmap according to the values of the corresponding matrix elements of test. Let's say: col-c(red,yellow,green) for test[1,1], the color on the map should be red. I have tried par('usr') and par('mar') with rect function. But this does not work because the rect shift from the original map. Could any one tell me how to fill the cells on the map with corresponding values? Or can we get the actual coordinates of the image excluding the dendregram. Any help would be appreciated. Thanks in advance! Xiaohui __ R-help@stat.math.ethz.ch 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.
[R] Heatmap color specification
hi, I have a positive integer matrix like: test-matrix(c(1,2,2,2,2,1,1,2,3),3) and based on the distant function I made like this: generateDistMat-function (target) { n - nrow(target) rn - rownames(target) distM - matrix(NA, n, n) diag(distM) - 0 for (i in 1:(n - 1)) for (j in (i + 1):n) { distM[i, j] - length(which(target[i, ] != target[j, ])) distM[j, i] - distM[i, j] } colnames(distM) - rownames(distM) - rn distM } dist.fun - function(M) return(as.dist(generateDistMat(M))) Then, I did a heatmap for 'test' matrix. But for now, I want to specify each of the cell in the heatmap according to the values of the corresponding matrix elements of test. Let's say: col-c(red,yellow,green) for test[1,1], the color on the map should be red. I have tried par('usr') and par('mar') with rect function. But this does not work because the rect shift from the original map. Could any one tell me how to fill the cells on the map with corresponding values? Or can we get the actual coordinates of the image excluding the dendregram. Any help would be appreciated. Thanks in advance! Xiaohui __ R-help@stat.math.ethz.ch 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.
[R] heatmap from xyz data
Hi, I've got some data in a data frame arranged like this: x y z othervariables 0.1 0.2 1.7 0.01 0.2 0.2 1.3 0.23 0.2 0.3 1.1 0.43 etc I'd like to plot a heatmap of this data, with x and y as the (x,y) co- ords and z defining the colour at each point. I'm having difficulty finding the correct functions to use. Can anyone make any recommendations? It seems straightforward to make the plot using the image function if the data is in matrix form, but I'm not sure how to transform my xyz data into matrix form. Many thanks in advance for your help. Best wishes, Trevor - Trevor Graham Centre for Mathematics and Physics in the Life Sciences and Experimental Biology (CoMPLEX) Cancer Research UK CoMPLEX, Wolfson House University College London, Gower Street London WC1E 6BT, UK Tel: +44 (0)20 7679 5088 Internal: 25088 http://trevor.complex.ucl.ac.uk __ R-help@stat.math.ethz.ch 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.
Re: [R] heatmap from xyz data
You can use plot(y~x,col=color.index.in.palette.defined.from(z),pch=20,type=p) where color.index.in.palette.defined.from(z) is a function or an expression, returning either a color index in a predefined palette or any other color representation, suitable for R. This is described in ?par. I have successfuly used col=z*10 with your sample data. type=p specifies, that points will be plotted. pch=20 says to plot them as small filled circles, sometimes I needed smaller circles, and pch=183 worked for me. The package fields and several other packages related to the spatial statistics are able to plot irregularly distributed point data and interpolate them to a regular grid (produce a 'contiguous' map). Here are some links: http://sal.uiuc.edu/csiss/Rgeo/ http://r-spatial.sourceforge.net/ You can also try RSiteSearch(spatial) or help.search(spatial) from the R console Trevor Graham wrote: I've got some data in a data frame arranged like this: x y z othervariables 0.1 0.2 1.7 0.01 0.2 0.2 1.3 0.23 0.2 0.3 1.1 0.43 etc I'd like to plot a heatmap of this data, with x and y as the (x,y) coords and z defining the colour at each point. I'm having difficulty finding the correct functions to use. Can anyone make any recommendations? It seems straightforward to make the plot using the image function if the data is in matrix form, but I'm not sure how to transform my xyz data into matrix form. -- View this message in context: http://www.nabble.com/-R--heatmap-from-xyz-data-tf3180966.html#a8827597 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch 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.
[R] heatmap with levelplot?
Hi, How do I anchor z=0 to the white color in a levelplot so that the color changes from cyan to magenta precisely as z changes from negative to positive? Also is it easy to change color scheme, say to blue/red as it's more dramatic? Is there a better function for showing heatmap with a color bar? Thanks in advance for any help, I've played with image, heatmap and levelplot a little and haven't gotten very far. Yuli Zhou __ R-help@stat.math.ethz.ch 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.
Re: [R] heatmap with levelplot?
On 12/22/06, Yuli Zhou [EMAIL PROTECTED] wrote: Hi, How do I anchor z=0 to the white color in a levelplot so that the color changes from cyan to magenta precisely as z changes from negative to positive? The changepoints are defined by 'at', and the colors are chosen more or less linearly, so you need to make sure 0 is near the center of your 'at'. E.g. levelplot(cor(mtcars), at = seq(-1.01, 1.01, length = 20)) Also is it easy to change color scheme, say to blue/red as it's more dramatic? Sure, e.g. bluered = colorRampPalette(c(red, white, blue), space = Lab) levelplot(volcano, col.regions = bluered(100), cuts = 99) Is there a better function for showing heatmap with a color bar? Thanks in advance for any help, I've played with image, heatmap and levelplot a little and haven't gotten very far. Yuli Zhou __ R-help@stat.math.ethz.ch 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. __ R-help@stat.math.ethz.ch 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.
[R] Heatmap.2 in gplots
I used the function heatmap.2 some times ago, and it worked as intended (for me...). I tried to reuse my old R program and I encounter some trouble. I suppose that something was changed in newer versions. One of the examples given in the help page shows the same problem : -- this part wa ## For variable clustering, rather use distance based on cor(): data(USJudgeRatings) symnum( cU - cor(USJudgeRatings) ) hU - heatmap.2(cU, Rowv=FALSE, symm=TRUE, col=topo.colors(16), distfun=function(c) as.dist(1 - c), trace=none) ## The Correlation matrix with same reordering: hM - format(round(cU[hU[[1]], hU[[2]]], 2)) hM # now with the correlation matrix on the plot itself heatmap.2(cU, Rowv=FALSE, symm=TRUE, col=rev(heat.colors(16)), distfun=function(c) as.dist(1 - c), trace=none, cellnote=hM) When running this correlation values are supposed to appear on the plot. But, as one can see in this example, the same value is not associated with the same color ( sometimes 1.00 is red or pale yellow). Looks like some reordering done on colors was'nt done on cellnotes. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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.
[R] heatmap problem with clustering columns
Dear All, I'm trying to get a heatmap for my n*m matrix, I want to cluster the m samples (columns) using kmeans with manhattan distance. I was able to use hclust method to cluster the m samples, but failed to figure out how to use kmeans. Any suggestion is very welcome! Best, Cao __ R-help@stat.math.ethz.ch 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.
[R] heatmap.2 in gplots package
Hello all, I am using the heatmap.2 function in the gplots package. I want to supress the reordering of the columns of the data matrix i pass to the function. I used the statement, heatmap.2(z,Colv=FALSE,dendrogram=row,col=redgreen(75)) where z, is the matrix of data. The output i want should have the rows reordered along with the dendrogram and the columns should be in the original order without any dendrogram. For the above statement i am getting an error: 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) I also tried using , heatmap.2(z,Colv=NULL,dendrogram=row,col=redgreen(75)) for which i am getting the output, but the columns are reordered. How can this be done for the way in which i want the map to appear? Thanks, svakki. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] heatmap.2 in gplots package
Hello Akkineni, This bug has already been reported and we have a tentative solution that we are testing. I'll send you a copy of the modified code once we finish testing. -G -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Akkineni,Vasundhara Sent: Wednesday, February 22, 2006 12:09 PM To: r-help@stat.math.ethz.ch Subject: [R] heatmap.2 in gplots package Hello all, I am using the heatmap.2 function in the gplots package. I want to supress the reordering of the columns of the data matrix i pass to the function. I used the statement, heatmap.2(z,Colv=FALSE,dendrogram=row,col=redgreen(75)) where z, is the matrix of data. The output i want should have the rows reordered along with the dendrogram and the columns should be in the original order without any dendrogram. For the above statement i am getting an error: 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) I also tried using , heatmap.2(z,Colv=NULL,dendrogram=row,col=redgreen(75)) for which i am getting the output, but the columns are reordered. How can this be done for the way in which i want the map to appear? Thanks, svakki. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] heatmap.2 in gplots package
On 2/22/06 12:09 PM, Akkineni,Vasundhara [EMAIL PROTECTED] wrote: Hello all, I am using the heatmap.2 function in the gplots package. I want to supress the reordering of the columns of the data matrix i pass to the function. I used the statement, heatmap.2(z,Colv=FALSE,dendrogram=row,col=redgreen(75)) where z, is the matrix of data. The output i want should have the rows reordered along with the dendrogram and the columns should be in the original order without any dendrogram. For the above statement i am getting an error: 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) I also tried using , heatmap.2(z,Colv=NULL,dendrogram=row,col=redgreen(75)) for which i am getting the output, but the columns are reordered. How can this be done for the way in which i want the map to appear? Use Colv=1:ncol(z), I think. Sean __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] heatmap.2 in gplots package
I used Colv=1:ncol(z), and i got the display the way i need it. Thanks. One more question, is there a way to increase the size of the color key in heatmap.2 so that all the tick values(for Eg.,in my case, values range between 10,000-50,000) can be seen clearly. In the normal case i am just able to see the initial tick value which is 10,000. Please suggest a better way to do this. Thanks for the help. svakki. -Original Message- From: Sean Davis [EMAIL PROTECTED] To: Akkineni,Vasundhara [EMAIL PROTECTED], r-help r-help@stat.math.ethz.ch Date: Wed, 22 Feb 2006 12:55:25 -0500 Subject: Re: [R] heatmap.2 in gplots package On 2/22/06 12:09 PM, Akkineni,Vasundhara [EMAIL PROTECTED] wrote: Hello all, I am using the heatmap.2 function in the gplots package. I want to supress the reordering of the columns of the data matrix i pass to the function. I used the statement, heatmap.2(z,Colv=FALSE,dendrogram=row,col=redgreen(75)) where z, is the matrix of data. The output i want should have the rows reordered along with the dendrogram and the columns should be in the original order without any dendrogram. For the above statement i am getting an error: 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) I also tried using , heatmap.2(z,Colv=NULL,dendrogram=row,col=redgreen(75)) for which i am getting the output, but the columns are reordered. How can this be done for the way in which i want the map to appear? Use Colv=1:ncol(z), I think. Sean __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] heatmap.2 in gplots package
On 2/22/06 3:15 PM, Akkineni,Vasundhara [EMAIL PROTECTED] wrote: I used Colv=1:ncol(z), and i got the display the way i need it. Thanks. One more question, is there a way to increase the size of the color key in heatmap.2 so that all the tick values(for Eg.,in my case, values range between 10,000-50,000) can be seen clearly. In the normal case i am just able to see the initial tick value which is 10,000. Please suggest a better way to do this. As far as I know there is not an easy way to do this without hacking the heatmap.2 code, but I could be wrong. For the purposes of making final plots, I typically find that the best thing to do is to make a PDF of the plot and then edit using Adobe or some such thing. Sean __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Heatmap.2 axes question
I'm suppressing the labeling of my rows and columns in heatmap.2 using the commands: labRow = , labCol = But I'd like to annotate them again using the axis command: axis(1, at=seq(500, 1000, 500)) mtext(Group 1, Group 2) For some reason however it appears that the axis command is having no effect. My complete code is: hv - heatmap.2(hmrf, Rowv=1:nrow(hmrf), Colv=1:ncol(hmrf), symm=TRUE, margin=c(6, 6), trace=none, col=terrain.colors(256), main = Heatmap: Respondent Proximities, tracecol=red, dendrogram=none, colsep=c(398, 811), rowsep=c(398, 811), labRow = , labCol = ) axis(1, at=seq(500, 1000, 500)) mtext(Group 1, Group 2) Note: I'm preventing re-ordering so that observations within groups are adjacent to one another. The data is a proximity matrix produced by random forests. I suspect I'm making a simple error but not sure what it is. Any advice would be appreciated. I'm using R 2.2.1 on a Windows XP machine. Many thanks, Joe Retzer [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] heatmap aspect ratio
You can change the code of layout: layout(lmat, widths = lwid, heights = lhei, respect = TRUE) layout(lmat, widths = lwid, heights = lhei, respect = FALSE) (best to create a new function my.layout with the modified code) Jacob Michaelson wrote: Hi all, Does anyone know of a fairly easy way to stretch a heatmap vertically? I've got 42 arrays and would like to be able to see as many significant genes as possible (right now I can only get 50 genes with it still being readable). In some comparisons there are several hundred significant genes. I've fiddled with the asp argument, but that doesn't give the results I'm looking for -- only scales the images, not the dendrograms. Is there any way to make the heatmap rectangular rather than square without hacking the heatmap function itself (which is where I'm headed next)? Thanks in advance, Jake __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] heatmap
Andrea Zangrando wrote: Hi, i created a graph with heatmap(sma) function: heatmap(dataHeat(x)) and I wish to change the gradation of colors from blue to red, how could i do? Using heatmap(dataHeat(x), col=c(2,4)) i will use only 2 colors without gradation. The color.gradient function in the plotrix package returns a sequence of interpolated colors between any two starting colors or incomplete sequences of primaries. I noticed that a function named ramp (in the base package?) was mentioned, but I could not find it. If there is a function equivalent to color.gradient, I would like to know about it, as I try to avoid duplicating functions. Jim __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] heatmap
On Tue, 4 Oct 2005, Jim Lemon wrote: Andrea Zangrando wrote: Hi, i created a graph with heatmap(sma) function: heatmap(dataHeat(x)) and I wish to change the gradation of colors from blue to red, how could i do? Using heatmap(dataHeat(x), col=c(2,4)) i will use only 2 colors without gradation. The color.gradient function in the plotrix package returns a sequence of interpolated colors between any two starting colors or incomplete sequences of primaries. I noticed that a function named ramp (in the base package?) was mentioned, but I could not find it. If there is a function equivalent to color.gradient, I would like to know about it, as I try to avoid duplicating functions. see ?colorRamp and look at: colorRampPalette function (colors, ...) { ramp - colorRamp(colors, ...) function(n) { x - ramp(seq(0, 1, length = n)) rgb(x[, 1], x[, 2], x[, 3], max = 255) } } to see where it comes from. The colorRamp/colorRampPalette combination is quite remarkable and lots of fun ... Roger Jim __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] heatmap ordered list
Hi, another problem on heatmaps... after generating the graph with myBlRd - colorRampPalette(c(blue, red)) heatmap(dataHeat[Top100, ], col=myBlRd(15)) i need to retrieve the row names' list ordered by the dendrogram. I tried with rownames(data)[Top100] but the list is not ordered (as i can see in the generated picture). Any tips? Tnx AZ -- Andrea Zangrando - Ph.D. Student University of Padova Department of Pediatrics Laboratory of Pediatric OncoHematology Via Giustiniani, 3 35128 Padova - Italy Phone: +39 049 8211457 Fax: +39 049 8211456 Email: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] heatmap ordered list
Andrea == Andrea Zangrando [EMAIL PROTECTED] on Tue, 04 Oct 2005 15:00:27 +0200 writes: Andrea Hi, Andrea another problem on heatmaps... after generating the graph with Andrea myBlRd - colorRampPalette(c(blue, red)) Andrea heatmap(dataHeat[Top100, ], col=myBlRd(15)) Andrea i need to retrieve the row names' list ordered by the dendrogram. Andrea I tried with rownames(data)[Top100] but the list is not ordered Andrea (as i can see in the generated picture). Any tips? Main tip : do read the help page for functions you are using. 2nd tip : There's a section called Value: 3rd tip : hence use r - heatmap(...) ## and work with 'r' Regards, Martin Maechler, ETH Zurich __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] heatmap
Hi, i created a graph with heatmap(sma) function: heatmap(dataHeat(x)) and I wish to change the gradation of colors from blue to red, how could i do? Using heatmap(dataHeat(x), col=c(2,4)) i will use only 2 colors without gradation. Ty so much Andrea __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] heatmap
Le 03.10.2005 14:24, Andrea Zangrando a écrit : Hi, i created a graph with heatmap(sma) function: heatmap(dataHeat(x)) and I wish to change the gradation of colors from blue to red, how could i do? Using heatmap(dataHeat(x), col=c(2,4)) i will use only 2 colors without gradation. Ty so much Andrea Hello, Check bluered() in the gplots package. Romain -- visit the R Graph Gallery : http://addictedtor.free.fr/graphiques ~ ~~ Romain FRANCOIS - http://addictedtor.free.fr ~~ Etudiant ISUP - CS3 - Industrie et Services ~~http://www.isup.cicrp.jussieu.fr/ ~~ Stagiaire INRIA Futurs - Equipe SELECT ~~ http://www.inria.fr/recherche/equipes/select.fr.html~~ ~ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] heatmap
Andrea Zangrando a écrit : ... and I wish to change the gradation of colors from blue to red, how could i do? Hello, here's how I build such a palette. a = 15; palwhiteblue = rgb(a:0, a:0, a, max=a); palredwhite = rgb(a, 0:a, 0:a, max=a); palwhite = rep(rgb(1,1,1), 8); palRWB = c(palredwhite, palwhite, palwhiteblue); of course, to adapt to your own uses. hih Vincent __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] heatmap
On Mon, 3 Oct 2005, Romain Francois wrote: Le 03.10.2005 14:24, Andrea Zangrando a écrit : Hi, i created a graph with heatmap(sma) function: heatmap(dataHeat(x)) and I wish to change the gradation of colors from blue to red, how could i do? Using heatmap(dataHeat(x), col=c(2,4)) i will use only 2 colors without gradation. Ty so much Andrea Hello, Check bluered() in the gplots package. Or roll your own in base: myBlRd - colorRampPalette(c(blue, red)) myBlRd function (n) { x - ramp(seq(0, 1, length = n)) rgb(x[, 1], x[, 2], x[, 3], max = 255) } environment: 0x9a5792c myBlRd(15) [1] #FF #1200EC #2400DA #3600C8 #4800B6 #5B00A3 #6D0091 [8] #7F007F #91006D #A3005B #B60048 #C80036 #DA0024 #EC0012 [15] #FF Romain -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] heatmap question
I'm having trouble with the heatmap function in R. When I try and heatmap something, my graphics window does not open. Does anyone know if this is a glitch in the version of R that I'm using? I've listed my version of R below, as well as a simple heatmap command. I'm running the program on a Mac, OS 10 v 10.3.9. Any suggestions?? Thanks! Peter version _ platform powerpc-apple-darwin6.8 arch powerpc os darwin6.8 system powerpc, darwin6.8 status major2 minor0.1 year 2004 month11 day 15 language R x-matrix(rnorm(100),nr=10) heatmap(x) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] heatmap question
Does any other plotting function work as they should e.g. plot(1:10) or are you connecting remotely to a server ? Regards, Adai On Mon, 2005-09-12 at 10:51 -0400, Peter Scacheri wrote: I'm having trouble with the heatmap function in R. When I try and heatmap something, my graphics window does not open. Does anyone know if this is a glitch in the version of R that I'm using? I've listed my version of R below, as well as a simple heatmap command. I'm running the program on a Mac, OS 10 v 10.3.9. Any suggestions?? Thanks! Peter version _ platform powerpc-apple-darwin6.8 arch powerpc os darwin6.8 system powerpc, darwin6.8 status major2 minor0.1 year 2004 month11 day 15 language R x-matrix(rnorm(100),nr=10) heatmap(x) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] heatmap question
Peter Scacheri a écrit : I'm having trouble with the heatmap function in R. When I try and heatmap something, my graphics window does not open. Does anyone know if this is a glitch in the version of R that I'm using? I've listed my version of R below, as well as a simple heatmap command. I'm running the program on a Mac, OS 10 v 10.3.9. Any suggestions?? perhaps try image(x, col = heat.colors(100)) and let us know the result hih __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] heatmap question
Hmmm...Seems to work OK now. Thanks for your help. Peter At 11:30 AM -0400 9/12/05, [EMAIL PROTECTED] wrote: Peter Scacheri a écrit : I'm having trouble with the heatmap function in R. When I try and heatmap something, my graphics window does not open. Does anyone know if this is a glitch in the version of R that I'm using? I've listed my version of R below, as well as a simple heatmap command. I'm running the program on a Mac, OS 10 v 10.3.9. Any suggestions?? perhaps try image(x, col = heat.colors(100)) and let us know the result hih __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.htmlhttp://www.R-project.org/posting-guide.html [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] heatmap -- invisible list?
Hi all, In heatmap's documentation, it mentions that the output value is actually an invisible list...how would one access this list? Thanks, Jake __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] heatmap -- invisible list?
On 8/8/05 9:45 AM, Jacob Michaelson [EMAIL PROTECTED] wrote: Hi all, In heatmap's documentation, it mentions that the output value is actually an invisible list...how would one access this list? Mylist - heatmap() __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] heatmap row names as char vector?
Hi All, Could anyone help me on how to output the row names of a heatmap as a character vector? I'm looking for a way to have the names in a list (or similar) in the same order as they appear in the clustering of the heatmap. Thanks in advance, Jake __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] heatmap color distribution
Hi all, I've got a set of gene expression data, and I'm plotting several heatmaps for subsets of the whole set. I'd like the heatmaps to have the same color distribution, so that comparisons may be made (roughly) across heatmaps; this would require that the color distribution and distance functions be based on the entire dataset, rather than on individual subsets. Does anyone know how to do this? Thanks in advance, Jake __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] heatmap color distribution
You can use the breaks argument in image to do this. (You don't specify a function you're using, but other heatmap functions probably have a similar parameter.) Look across all your data, figure out the ranges you want to have different colors, and specify the appropriate break points in each call to image. Then you're using the same color set in each one. You run the risk, of course, that some of your images will have a very narrow color range, which might obscure interesting features. But nothing stops you from making more than one plot. Hope this helps. Regards, Matt Wiener -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jacob Michaelson Sent: Thursday, July 21, 2005 9:26 AM To: r-help@stat.math.ethz.ch Subject: [R] heatmap color distribution Hi all, I've got a set of gene expression data, and I'm plotting several heatmaps for subsets of the whole set. I'd like the heatmaps to have the same color distribution, so that comparisons may be made (roughly) across heatmaps; this would require that the color distribution and distance functions be based on the entire dataset, rather than on individual subsets. Does anyone know how to do this? Thanks in advance, Jake __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] heatmap color distribution
Thanks for the reply. As I understand it, breaks only controls the binning. The problem I'm having is that each subset heatmap has slightly different min and max log2 intensities. I'd like the colors to be based on the overall (complete set) max and min, not the subsets' max and min -- I could be wrong, but I don't think breaks will help me there. And you're right - this might obscure some of the trends/features, but we'll also plot the default heatmaps. Also (I should have specified) I'm using heatmap.2. Thanks, Jake On Jul 21, 2005, at 8:09 AM, Wiener, Matthew wrote: You can use the breaks argument in image to do this. (You don't specify a function you're using, but other heatmap functions probably have a similar parameter.) Look across all your data, figure out the ranges you want to have different colors, and specify the appropriate break points in each call to image. Then you're using the same color set in each one. You run the risk, of course, that some of your images will have a very narrow color range, which might obscure interesting features. But nothing stops you from making more than one plot. Hope this helps. Regards, Matt Wiener -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jacob Michaelson Sent: Thursday, July 21, 2005 9:26 AM To: r-help@stat.math.ethz.ch Subject: [R] heatmap color distribution Hi all, I've got a set of gene expression data, and I'm plotting several heatmaps for subsets of the whole set. I'd like the heatmaps to have the same color distribution, so that comparisons may be made (roughly) across heatmaps; this would require that the color distribution and distance functions be based on the entire dataset, rather than on individual subsets. Does anyone know how to do this? Thanks in advance, Jake __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html --- --- Notice: This e-mail message, together with any attachment...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] heatmap color distribution
Breaks affects the binning into colors. Try this. Assume that temp is one of your data sets. It's values are restricted to 0.25 - 0.75, and we'll assume that the full data set goes from 0 to 1. temp - matrix(runif(60, 0.25, 0.75), nc = 6) breaks - seq(from = 0, to = 1, length = 11) image(temp2, col = heat.colors(10)) # full range of color image(temp2, col = heat.colors(10), breaks = breaks)# muted colors The second image is told about all the colors, and about the full range of data through breaks, and only uses the colors in the middle. Is that what you mean? HTH, Matt -Original Message- From: Jake Michaelson [mailto:[EMAIL PROTECTED] Sent: Thursday, July 21, 2005 10:45 AM To: Wiener, Matthew Cc: R-help@stat.math.ethz.ch Subject: Re: [R] heatmap color distribution Thanks for the reply. As I understand it, breaks only controls the binning. The problem I'm having is that each subset heatmap has slightly different min and max log2 intensities. I'd like the colors to be based on the overall (complete set) max and min, not the subsets' max and min -- I could be wrong, but I don't think breaks will help me there. And you're right - this might obscure some of the trends/features, but we'll also plot the default heatmaps. Also (I should have specified) I'm using heatmap.2. Thanks, Jake On Jul 21, 2005, at 8:09 AM, Wiener, Matthew wrote: You can use the breaks argument in image to do this. (You don't specify a function you're using, but other heatmap functions probably have a similar parameter.) Look across all your data, figure out the ranges you want to have different colors, and specify the appropriate break points in each call to image. Then you're using the same color set in each one. You run the risk, of course, that some of your images will have a very narrow color range, which might obscure interesting features. But nothing stops you from making more than one plot. Hope this helps. Regards, Matt Wiener -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jacob Michaelson Sent: Thursday, July 21, 2005 9:26 AM To: r-help@stat.math.ethz.ch Subject: [R] heatmap color distribution Hi all, I've got a set of gene expression data, and I'm plotting several heatmaps for subsets of the whole set. I'd like the heatmaps to have the same color distribution, so that comparisons may be made (roughly) across heatmaps; this would require that the color distribution and distance functions be based on the entire dataset, rather than on individual subsets. Does anyone know how to do this? Thanks in advance, Jake __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html --- --- Notice: This e-mail message, together with any attachment...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] heatmap color distribution
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Jacob Michaelson Sent: 21 July 2005 12:26 To: r-help@stat.math.ethz.ch Subject: [R] heatmap color distribution Hi all, I've got a set of gene expression data, and I'm plotting several heatmaps for subsets of the whole set. I'd like the heatmaps to have the same color distribution, so that comparisons may be made (roughly) across heatmaps; this would require that the color distribution and distance functions be based on the entire dataset, rather than on individual subsets. Does anyone know how to do this? Thanks in advance, For each heatmap, in image() set the zlim argument to c(zmin,zmax) where zmin and zmax are the minimum and maximum observed across the entire data set. Also, for each heatmap set col=heat.colors(n) to the same n for all heatmaps. I do that with image.kriging in geoR. Hope it works for you. Ruben __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] heatmap not symmetric ?
Dear list, I hope it is not a FAQ, but I searched the archives and Google, and found nothing. The question is simple : I do not understand why, starting from a symmetrical correlation matrix, heatmap produces an asymmetrical image. Best, Charles -- Charles Plessy, Ph.D. - Genome Science Laboratory The Institute for Physical and Chemical Research (RIKEN) 2-1 Hirosawa, Wako, Saitama 351-0198, Japan Fax: 048-462-4686 -- Tel: 048-467-9515 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] heatmap not symmetric ?
From: Charles Plessy Dear list, I hope it is not a FAQ, but I searched the archives and Google, and found nothing. The question is simple : I do not understand why, starting from a symmetrical correlation matrix, heatmap produces an asymmetrical image. Umm... because you haven't read the help page for heatmap carefully enough? It says: symmlogical indicating if x should be treated symmetrically; can only be true when x is a square matrix. I believe Martin added this after some discussion on R-help. Andy Best, Charles -- Charles Plessy, Ph.D. - Genome Science Laboratory The Institute for Physical and Chemical Research (RIKEN) 2-1 Hirosawa, Wako, Saitama 351-0198, Japan Fax: 048-462-4686 -- Tel: 048-467-9515 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] heatmap aspect ratio
Hi all, Does anyone know of a fairly easy way to stretch a heatmap vertically? I've got 42 arrays and would like to be able to see as many significant genes as possible (right now I can only get 50 genes with it still being readable). In some comparisons there are several hundred significant genes. I've fiddled with the asp argument, but that doesn't give the results I'm looking for -- only scales the images, not the dendrograms. Is there any way to make the heatmap rectangular rather than square without hacking the heatmap function itself (which is where I'm headed next)? Thanks in advance, Jake __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] heatmap aspect ratio
On Jun 16, 2005, at 9:47 AM, Jacob Michaelson wrote: Hi all, Does anyone know of a fairly easy way to stretch a heatmap vertically? I've got 42 arrays and would like to be able to see as many significant genes as possible (right now I can only get 50 genes with it still being readable). In some comparisons there are several hundred significant genes. I've fiddled with the asp argument, but that doesn't give the results I'm looking for -- only scales the images, not the dendrograms. Is there any way to make the heatmap rectangular rather than square without hacking the heatmap function itself (which is where I'm headed next)? Jacob, I use heatmap.2 from the gplots package (part of gregmisc bundle). It is more customizable than heatmap. Sean __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] heatmap.2 ordering color key
HI All sorry if this question has already been asked but I couldn't find anything that answered my question I have 24 columns of data that I'm trying to plot in heatmap.2 (gregmisc) and I'm having difficulty ordering them except in numerical sequence: I have transposed my matrix so it will appear with the dendrogram I want appearing at the top of the heatmap If I use either of these orders the ordering works: order - c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24) order2 - c(24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1) using the command: heatmap.2(tmatrix, clusteredmatrixasdendrogram, col=bluered600, dendrogram=column, scale=none, trace=none, Rowv=order) however If I start mixing the numbers up e.g: order3 - c(1,4,7,10,2,5,8,11,3,6,9,12,13,16,19,22,14,17,20,23,15,18,21,24) or order4 - c(24,21,18,15,23,20,17,14,22,19,16,13,12,9,6,3,11,8,5,2,10,7,4,1) The heatmap is reordered but NOT how I have specified: The actual order it returns in either case is the same: 1,5,9,2,6,10,3,7,11,4,8,12,13,17,21,14,18,22,15,19,23,16,20,24 which I'm completely confused about as I'm not plotting a dendrogram for the rows or letting the heatmap function draw its own so where is it getting the order from ? and is it possible to plot it like I'm trying to ? My second question is also from the gregmisc package I'm using bluered600 - bluered(600) to specify the range of colors plotted my data ranges from -60 to +80 but I would like to specify that the colours range from blue to red with white being zero however because of the unequal distribution zero is shifted into the red area (hope that makes sense) I know I can specify colors for low medium and high, in some graphics functions but this isn't what I'm trying to do unless my data is evenly distributed i.e -60 to +60 I can't plot exactly how I want to If anyone has any ideas that would be fantastic Cheers Jason -- Jason Skelton Pathogen Microarrays Wellcome Trust Sanger Institute Hinxton Cambridge CB10 1SA Tel +44(0)1223 834244 Ext 7123 Fax +44(0)1223 494919 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] heatmap help
Hello, I was just doing heatmaps myself ;-) and I had the same problem. It would be nice to have such an example in the help file because it is not clear (thank you). you use (for example... this is my case, which I am doing the distance matrix using vegdist function with Bray curtis similarity): heatmap(matrix, scale=none, distfun=function(m) vegdist(m, method=bray), hclustfun=function(m) hclust(m, method=average), col= grey(seq(0.8,0,l=5))) or you can put directly the distance matrix that you may want, but I found it worst. To have the right labels on I found that the best way would be to have them in the matrix directely, because if we put it after it does not work well... I have been having difficulties in producing the scale that I want and doing the correct legend... I found an email with a function (image.scale()), but it does not work entirely well. How can I define the values I want in the scale, for example, use red for 1 g, blue for 2 g, etc... Is there a simpler way of doing the legend? thank you very much, Marta Dear R wizards, Hopeful someone can help me with what I believe is a pretty simple task. I pretty new to R so some (much) of the obvious escapes me. How do I get a distance matrix into heatmap? What do I tell distfun if what I'm trying to map is already an ordered distance matrix? I tried heatmap(x, distfun=as.dist(x)) where x is the distance matrix but R gave me an error. Thanks in advance for any help. Paul Lepp `-:-. ,-;`-:-. ,-;`-:-. ,-;`-:-. ,-;`-:-. ,-;`-:-. `=`,'=/ `=`,'=/ `=`,'=/ `=`,'=/ `=`,'=/ `=` ==/==/==/==/==/ ,=,-=`.,=,-=`.,=,-=`.,=,-=`.,=,-=`.,=, ,-'-' `-=_,-'-' `-=_,-'-' `-=_,-'-' `-=_,-'-' `-=_,-'-' Paul Lepp, Ph.D. Stanford School of Medicine VAPAHCS, 154T Dept. of Microbiology Immunology 3801 Miranda Ave Stanford University Palo Alto, CA 94304 Stanford, CA (650) 493-5000 x66762fax: (650) 852-3291 http://cmgm.stanford.edu/~pwlepp [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] heatmap help
Thanks Marta (and Andy). Between the two of you I think I got the result I was looking for. I ended up doing the following: heatmap(x, distfun=function(x) as.dist(x)) Thanks again. -Original Message- From: Marta Rufino [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 2:22 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [R] heatmap help Hello, I was just doing heatmaps myself ;-) and I had the same problem. It would be nice to have such an example in the help file because it is not clear (thank you). you use (for example... this is my case, which I am doing the distance matrix using vegdist function with Bray curtis similarity): heatmap(matrix, scale=none, distfun=function(m) vegdist(m, method=bray), hclustfun=function(m) hclust(m, method=average), col= grey(seq(0.8,0,l=5))) or you can put directly the distance matrix that you may want, but I found it worst. To have the right labels on I found that the best way would be to have them in the matrix directely, because if we put it after it does not work well... I have been having difficulties in producing the scale that I want and doing the correct legend... I found an email with a function (image.scale()), but it does not work entirely well. How can I define the values I want in the scale, for example, use red for 1 g, blue for 2 g, etc... Is there a simpler way of doing the legend? thank you very much, Marta Dear R wizards, Hopeful someone can help me with what I believe is a pretty simple task. I pretty new to R so some (much) of the obvious escapes me. How do I get a distance matrix into heatmap? What do I tell distfun if what I'm trying to map is already an ordered distance matrix? I tried heatmap(x, distfun=as.dist(x)) where x is the distance matrix but R gave me an error. Thanks in advance for any help. Paul Lepp `-:-. ,-;`-:-. ,-;`-:-. ,-;`-:-. ,-;`-:-. ,-;`-:-. `=`,'=/ `=`,'=/ `=`,'=/ `=`,'=/ `=`,'=/ `=` ==/==/==/==/==/ ,=,-=`.,=,-=`.,=,-=`.,=,-=`.,=,-=`.,=, ,-'-' `-=_,-'-' `-=_,-'-' `-=_,-'-' `-=_,-'-' `-=_,-'-' Paul Lepp, Ph.D. Stanford School of Medicine VAPAHCS, 154T Dept. of Microbiology Immunology 3801 Miranda Ave Stanford University Palo Alto, CA 94304 Stanford, CA (650) 493-5000 x66762fax: (650) 852-3291 http://cmgm.stanford.edu/~pwlepp [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] heatmap help
Dear R wizards, Hopeful someone can help me with what I believe is a pretty simple task. I pretty new to R so some (much) of the obvious escapes me. How do I get a distance matrix into heatmap? What do I tell distfun if what I'm trying to map is already an ordered distance matrix? I tried heatmap(x, distfun=as.dist(x)) where x is the distance matrix but R gave me an error. Thanks in advance for any help. Paul Lepp `-:-. ,-;`-:-. ,-;`-:-. ,-;`-:-. ,-;`-:-. ,-;`-:-. `=`,'=/ `=`,'=/ `=`,'=/ `=`,'=/ `=`,'=/ `=` ==/==/==/==/==/ ,=,-=`.,=,-=`.,=,-=`.,=,-=`.,=,-=`.,=, ,-'-' `-=_,-'-' `-=_,-'-' `-=_,-'-' `-=_,-'-' `-=_,-'-' Paul Lepp, Ph.D. Stanford School of Medicine VAPAHCS, 154T Dept. of Microbiology Immunology 3801 Miranda Ave Stanford University Palo Alto, CA 94304 Stanford, CA (650) 493-5000 x66762 fax: (650) 852-3291 http://cmgm.stanford.edu/~pwlepp [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] heatmap help
I believe you want to pass the (symmetric) matrix as is, rather than wrapped in as.dist(). E.g., x - as.matrix(dist(matrix(rnorm(100), 20, 5))) heatmap(x, symm=TRUE, scale=none) HTH, Andy From: Paul Lepp Dear R wizards, Hopeful someone can help me with what I believe is a pretty simple task. I pretty new to R so some (much) of the obvious escapes me. How do I get a distance matrix into heatmap? What do I tell distfun if what I'm trying to map is already an ordered distance matrix? I tried heatmap(x, distfun=as.dist(x)) where x is the distance matrix but R gave me an error. Thanks in advance for any help. Paul Lepp `-:-. ,-;`-:-. ,-;`-:-. ,-;`-:-. ,-;`-:-. ,-;`-:-. `=`,'=/ `=`,'=/ `=`,'=/ `=`,'=/ `=`,'=/ `=` ==/==/==/==/==/ ,=,-=`.,=,-=`.,=,-=`.,=,-=`.,=,-=`.,=, ,-'-' `-=_,-'-' `-=_,-'-' `-=_,-'-' `-=_,-'-' `-=_,-'-' Paul Lepp, Ph.D. Stanford School of Medicine VAPAHCS, 154T Dept. of Microbiology Immunology 3801 Miranda Ave Stanford University Palo Alto, CA 94304 Stanford, CA (650) 493-5000 x66762fax: (650) 852-3291 http://cmgm.stanford.edu/~pwlepp [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] heatmap help
Sorry. I think you need the argument distfun=as.dist. E.g., heatmap(x, distfun=as.dist, symm=TRUE, scale=none) Andy From: Liaw, Andy I believe you want to pass the (symmetric) matrix as is, rather than wrapped in as.dist(). E.g., x - as.matrix(dist(matrix(rnorm(100), 20, 5))) heatmap(x, symm=TRUE, scale=none) HTH, Andy From: Paul Lepp Dear R wizards, Hopeful someone can help me with what I believe is a pretty simple task. I pretty new to R so some (much) of the obvious escapes me. How do I get a distance matrix into heatmap? What do I tell distfun if what I'm trying to map is already an ordered distance matrix? I tried heatmap(x, distfun=as.dist(x)) where x is the distance matrix but R gave me an error. Thanks in advance for any help. Paul Lepp `-:-. ,-;`-:-. ,-;`-:-. ,-;`-:-. ,-;`-:-. ,-;`-:-. `=`,'=/ `=`,'=/ `=`,'=/ `=`,'=/ `=`,'=/ `=` ==/==/==/==/==/ ,=,-=`.,=,-=`.,=,-=`.,=,-=`.,=,-=`.,=, ,-'-' `-=_,-'-' `-=_,-'-' `-=_,-'-' `-=_,-'-' `-=_,-'-' Paul Lepp, Ph.D. Stanford School of Medicine VAPAHCS, 154T Dept. of Microbiology Immunology 3801 Miranda Ave Stanford University Palo Alto, CA 94304 Stanford, CA (650) 493-5000 x66762 fax: (650) 852-3291 http://cmgm.stanford.edu/~pwlepp [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. -- __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] heatmap for gene clustering?
I am using heatmap to cluster genes in microarrays. It works fine with 100~200 genes. But when I draw a heatmap with 600 genes, I can't read a clustering tree well. Maybe I will be able to read it by dividing it into several subtrees using a function such as subtree. I found subtree in Splus, but not in R. Is there a similar function in R? Or, without it, how can I solve this problem? HJ _ MSN Toolbar provides one-click access to Hotmail from any Web page FREE download! http://toolbar.msn.com/go/onm00200413ave/direct/01/ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] heatmap for gene clustering?
Look into ?cutree. Sean On 5/5/04 1:29 PM, Hyung Cho [EMAIL PROTECTED] wrote: I am using heatmap to cluster genes in microarrays. It works fine with 100~200 genes. But when I draw a heatmap with 600 genes, I can't read a clustering tree well. Maybe I will be able to read it by dividing it into several subtrees using a function such as subtree. I found subtree in Splus, but not in R. Is there a similar function in R? Or, without it, how can I solve this problem? HJ _ MSN Toolbar provides one-click access to Hotmail from any Web page FREE download! http://toolbar.msn.com/go/onm00200413ave/direct/01/ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] heatmap function
Hi all, By default, the heatmap function gives an image with a dendrogram added to the left side and to the top. Is it possible to only add the dendrogram to the left side and let the order of the columns unchanged ? I tried heatmap(mat, col=rbg,Rowv=res.hclust$order,Colv=1:dim(mat)[[2]]). In this case, the order of the columns are unchanged but a dendrogram is added to the top. How can I avoid it? Thanks, Oiliver -- - Martin Olivier INRA - Unité protéomique LIRMM - IFA/MAB 2, Place Viala 161, rue Ada 34060 Montpellier Cédex 1 34392 Montpellier Cédex 5 Tel : 04 99 61 27 01 Tel : O4 67 41 86 71 [EMAIL PROTECTED] [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] heatmap function
AndyL == Liaw, Andy [EMAIL PROTECTED] on Fri, 17 Oct 2003 09:10:16 -0400 writes: AndyL One of the good thing about R (and S in general, I AndyL guess) is that if a function does mostly what you AndyL want, except for some small things, you can just make AndyL another copy of it, change the name, and make the AndyL desired changes to the new function (provided the AndyL changes you need to make isn't in the compiled code, AndyL but R is Open Source...). AndyL In this case, you should be able to strip out the AndyL code in heatmap() that plot the top dendrogram w/o AndyL much problem. While your at it, you might want to AndyL change the layout() so as not to leave the blank AndyL space on top. Yes, thanks Andy. heatmap() has already been improved quite a bit for R 1.8.0 (and particularly the dendrogram reordering which lead to bad drawings has been fixed, the drawings are now fine). But I have received many suggestions (from Gregory Warnes, notably, and Art Owen, and others) that just didn't make it anymore in time before feature freeze. The above {an option for *dis*allowing one or the other dendrogram} has been among the wishes, and is reasonable. heatmap() being a relatively new function in R, and a high level one (i.e. typically not used as basic building bloc for other functions), not even usable as a sub-plot in other plots because it relies on layout(), but also widely used in some contexts I'd vote for being allowed to add features to it even before the next major release of R. -Original Message- From: Martin Olivier [mailto:[EMAIL PROTECTED] Sent: Friday, October 17, 2003 5:32 AM To: r-help Subject: [R] heatmap function Hi all, By default, the heatmap function gives an image with a dendrogram added to the left side and to the top. Is it possible to only add the dendrogram to the left side and let the order of the columns unchanged ? I tried heatmap(mat, col=rbg,Rowv=res.hclust$order,Colv=1:dim(mat)[[2]]). In this case, the order of the columns are unchanged but a dendrogram is added to the top. How can I avoid it? Thanks, Oiliver __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] heatmap and hclust
Hi all, The function heatmap uses the functions dist and hclust with default parameters. How to change these parameters? For example, i want to use the ward criterion for hierarchical clustering with binary distance. Best regards, Olivier. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] heatmap and hclust
On Wed, Sep 24, 2003 at 02:47:21PM +0200, Martin Olivier wrote: Hi all, The function heatmap uses the functions dist and hclust with default parameters. How to change these parameters? For example, i want to use the ward criterion for hierarchical clustering with binary distance. Best regards, Olivier. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help Specify what you want through the parameters distfun and hclustfun. Ex: my.dist - function(x) dist(x, method=binary) my.hclust - function(d) hclust(d, method=ward) hm - heatmap(blablabla, distfun=my.dist, hclustfun=my.hclust) Hopin' it helps, L. -- -- Laurent Gautier CBS, Building 208, DTU PhD. StudentDK-2800 Lyngby,Denmark tel: +45 45 25 24 89http://www.cbs.dtu.dk/laurent __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] heatmap
Dear R-users, I am using R-1.7.1. on windows 2000. When I use the heatmap() function, I found lines on the dendorgam are not well connected. For example, the two dendrograms produced by the following have this problem. set.seed(1234) heatmap(x-matrix(rnorm(100*30),100,30)) Is there a bug in plot(dendrogram object) which heatmap used? Thanks, Ming-Chung Li __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help