[R] Flipping a heatmap

David Khabie-Zeitoune dave at evocapital.com
Thu Sep 11 16:57:23 CEST 2003

Thanks to everyone who replied on this subject. Clearly, two rows of the
correlation matrix which have similar numerical entries represent two
variables which have similar correlations with the other variables.
Therefore clustering using a distance metric (e.g. dist) defined on the
rows (or equivalently columns) of the correlation matrix produces an
ordering which lumps together correlated variables. This had been my
original thinking (if a little fuzzy), but I've decided now to do the
clustering on the data matrix directly and just do an image plot of the
resulting re-ordered correlation matrix.

If any one else has good ideas about how to visualise correlation
structures in large correlation matrices, I'd love to hear them, on- or

-----Original Message-----
From: Duncan Murdoch [mailto:dmurdoch at pair.com] 
Sent: 11 September 2003 13:53
To: r-help at stat.math.ethz.ch
Subject: Re: [R] Flipping a heatmap

On Thu, 11 Sep 2003 07:46:16 -0400, you wrote:

>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.

There are several different ways you might organize the rows and columns
of a correlation matrix, but rearranging it to put equal correlations
together sounds like one sensible idea.  You'd probably want row and
column labels rather than the dendrogram heatmap() puts on, but other
than that, it seems like a nice idea to me.

Duncan Murdoch

R-help at stat.math.ethz.ch mailing list

More information about the R-help mailing list