Re: [R] Correlation Mapping

From: Gabor Grothendieck <>
Date: Mon 17 Jul 2006 - 15:52:35 EST

I have not seen that book cover but I assume the question is how to plot the cells of a correlation matrix in different colors. Try heatmap or the gplot package function heatmap.2 . For example, we create a correlation matrix, K, from the first 4 columns of the iris data set and create a heatmap using the bluered color scheme:

# heatmap.2
K <- cor(iris[,1:4])
heatmap.2(K, col = bluered(16), cexRow = .7, cexCol = .7, symm = TRUE,

        dend = "row", trace = "none", main = "Iris Data")

balloonplot, also in the gplots package, and image in graphics (i.e. core R) might be other functions to look at.

On 7/16/06, justin rapp <> wrote:
> On the cover of Zivot and Wang's Modeling Financial Time Series with S
> Plus, there is a correlation plot that seems to indicate the strength
> of correlation with color-coded squares, so that more highly
> correlated stocks appear darker red. If anybody out there is familiar
> with the book or understands what I am talking about, I am curious as
> to whether or not there is a similar function in R and how I can call
> it up.
> Thank you.
> jdr
> ______________________________________________
> mailing list
> PLEASE do read the posting guide!
> mailing list PLEASE do read the posting guide! Received on Mon Jul 17 15:57:04 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 17 Jul 2006 - 18:15:51 EST.

Mailing list information is available at Please read the posting guide before posting to the list.