[R] Could anyone tell me how to plot a hierarchical clustering in a black-white color?

Sundar Dorai-Raj sundar.dorai-raj at pdf.com
Fri Nov 12 00:19:19 CET 2004



Frank Duan wrote:

> Dear R people,
> 
> I am trying to do a hierarchical clustering to a matrix using
> heatmap() function. But I like to have the plot to display in a
> black-white manner? Could anyone tell me how to do that?
> 
> Thank you.
> 
> Frank
> 

Will ?gray do what you need?

# from ?heatmap
require(graphics)
x  <- as.matrix(mtcars)
rc <- gray(seq(0, 1, len = nrow(x)))
cc <- gray(seq(0, 1, len = ncol(x)))
col <- gray(seq(0, 1, len = 256))
hv <- heatmap(x, col = col, scale="column",
               RowSideColors = rc, ColSideColors = cc, margin=c(5,10),
               xlab = "specification variables", ylab= "Car Models",
               main = "heatmap(<Mtcars data>, ..., scale = \"column\")")

This is for R-2.0.0 on Win2000.

--sundar




More information about the R-help mailing list