[R] Plotting the correlation

Sasha Pustota popgen at gmail.com
Wed Apr 26 02:19:37 CEST 2006

Suppose I compute a correlation matrix ...

r <- cor(log(rbind(iris3[,,1], iris3[,,2], iris3[,,3])))

and then want to plot the values in color, e.g.
image(r, col = terrain.colors(200))

Why the matrix in the plot is rotated? The diagonal Rii=1 goes from
the bottom left to the upper right corner.

Is there a way to plot the color values in the same orientation as the
correlation matrix below? -

> print.table(r, digits=2)
         Sepal L. Sepal W. Petal L. Petal W.
Sepal L.     1.00    -0.11     0.84     0.80
Sepal W.    -0.11     1.00    -0.47    -0.45
Petal L.     0.84    -0.47     1.00     0.97
Petal W.     0.80    -0.45     0.97     1.00

More information about the R-help mailing list