Fearon Cassidy
2010-Mar-03 22:40 UTC
[R] Heatmap reordering of dendrogram to hierarchical clustering
Dear list members, I have been using R to create a heatmap where my data has continous variables from 0 to 100. When I create the heatmap, although the branches are correct, they do not order themselves so that the row with the most zeros is at one end and the row with the most 100s is at the other, which is what I would like them to do, so as to create a colour gradient down the graphic. I have tried to use reorderfun to fix this, and although it makes some change, the heatmap still does not look how I want. Can you help? I have been using: tmp <-read.table("Heat.txt",row.names=1,header=T) mydata <- data.matrix(tmp) rc <- rainbow(nrow(mydata),start=0, end=1) cc <- rainbow(ncol(mydata), start=0, end=1) hv <- heatmap(mydata, col = cm.colors(256), scale="column", RowSideColors = rc, ColSideColors = cc, margin=c(5,10), xlab = "Gene", ylab= "Species", main = "Heatmap", reorderfun = function(mydata,w) reorder(mydata,0.0:100.0), Colv=NULL, Rowv=T) Thnak you, Fearon Cassidy Department of Zoology Trinity College Dublin [[alternative HTML version deleted]]
gireesh bogu
2010-Mar-07 05:20 UTC
[R] Heatmap reordering of dendrogram to hierarchical clustering
data(warpbreaks) ## given two factors coplot(breaks ~ 1:54 | wool * tension, data = warpbreaks, col = "red", bg = "pink", pch = 21, bar.bg = c(fac = "light blue")) ################################################## conditionalplot ##################################################### On Wed, Mar 3, 2010 at 5:40 PM, Fearon Cassidy <fcassidy@tcd.ie> wrote:> Dear list members, > > I have been using R to create a heatmap where my data has continous > variables from 0 to 100. > When I create the heatmap, although the branches are correct, they do not > order themselves so that the row with the most zeros is at one end and the > row with the most 100s is at the other, which is what I would like them to > do, so as to create a colour gradient down the graphic. > I have tried to use reorderfun to fix this, and although it makes some > change, the heatmap still does not look how I want. > > Can you help? I have been using: > > tmp <-read.table("Heat.txt",row.names=1,header=T) > > mydata <- data.matrix(tmp) > > rc <- rainbow(nrow(mydata),start=0, end=1) > cc <- rainbow(ncol(mydata), start=0, end=1) > > hv <- heatmap(mydata, col = cm.colors(256), scale="column", > RowSideColors = rc, ColSideColors = cc, margin=c(5,10), > xlab = "Gene", ylab= "Species", > main = "Heatmap", reorderfun = function(mydata,w) > reorder(mydata,0.0:100.0), Colv=NULL, Rowv=T) > > Thnak you, > > Fearon Cassidy > Department of Zoology > Trinity College Dublin > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. >-- Regards Gireesh #HP#8375-9256 [[alternative HTML version deleted]]