[R] lines() in heatmap()
p.murrell at auckland.ac.nz
Mon Jan 23 20:33:39 CET 2006
> I looked for help through google and the help-files and spend several
> hours with trial and
> error, but didn't find a correct way.
> It's all about lines in a heatmap to separate different data block from
> each other to underline
> the significance of the found clusters!
> The heatmap is build like that:
> heatmap(X, Rowv=NA, Colv=NA, symm=TRUE, cexRow=0.3, cexCol=0.3)
> I switched the dendrograms off, because I don't want the values sorted
> but in the way, I
> extracted them from the data.
> I tried to enter the lines that way:
> lines(c(14,14),c(0,187), col="green")
> That should appear as a line parallel to the x-axis, but there was no
> line at all.
> I also tried several other ways, which didn't work at all. (The Matrix
> 187 values and is symmetric)
Take a look at the 'add.expr' argument to heatmap. Here's a simple example:
x <- as.matrix(mtcars)
rc <- rainbow(nrow(x), start=0, end=.3)
cc <- rainbow(ncol(x), start=0, end=.3)
hv <- heatmap(x, col = cm.colors(256), scale="column",
RowSideColors = rc, ColSideColors = cc, margin=c(5,10),
xlab = "specification variables", ylab= "Car Models",
main = "heatmap(<Mtcars data>, ..., scale = \"column\")",
# IMPORTANT BIT HERE
add.expr = abline(h=5, v=2))
> Also the line should start and end at the borders of the heatmap, so if
> there is
> a parameter to enter that, I would be glad, if you add it.
> Another short question:
> Does anybody have an idea, how I could switch the names of my data from
> the heatmaps
> right side to it's left side?
> Thanks for help already,
> Tobias Zimmer
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
64 9 3737599 x85392
paul at stat.auckland.ac.nz
More information about the R-help