[R] Flipping a heatmap

Liaw, Andy andy_liaw at merck.com
Thu Sep 11 13:46:16 CEST 2003


My feeling is that heatmap is not the right thing to use on a correlation
matrix.  The heatmap function expects a data matrix, and does a two-way
clustering of cases and variables.  It tries to rearrange the rows and
columns so that similar colors are closer together.  This obviously will not
work for a correlation matrix.  (The rearrangement is one of several
enhancements that Robert/Martin added to my original attempt.)

If you really want to do it, you may try to find my original naive version
of the heatmap function, which I posted to the Bioconductor mailing list
earlier this year.  That does not do any rearragement.

HTH,
Andy

> -----Original Message-----
> From: David Khabie-Zeitoune [mailto:dave at evocapital.com] 
> Sent: Thursday, September 11, 2003 4:04 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Flipping a heatmap
> 
> 
> Hi
> 
> I am using the heatmap function in package mva to look at 
> large correlation matrices visually. Is there any way to 
> "flip" the output of heatmap plot left-right so that, if 
> presented with a correlation matrix, it plots the unity 
> elements in the correlation matrix along a diagonal from top 
> left to bottom right?
> 
> For example:
> 
> library(mva)
> x = matrix(rnorm(1000), ncol=10)
> z = cor(x)
> heatmap(z)
> 
> Heatmap calls image, and I've found ways to do it with image e.g:
> 
> image(z[1:10,10:1]) 
> 
> will plot things the "right" way round, but
> 
> heatmap(z[1:10,10:1]) 
> 
> does not.
> 
> Any help much appreciated.
> Cheers,
> Dave
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list 
> https://www.stat.math.ethz.ch/mailman/listinfo> /r-help
> 

------------------------------------------------------------------------------
Notice:  This e-mail message, together with any attachments,...{{dropped}}




More information about the R-help mailing list