Try: image.matrix <- function (x, rlab = if (is.null(rownames(x))) 1:nrow(x) else rownames(x), clab = if (is.null(colnames(x))) 1:ncol(x) else colnames(x), cex.row=0.7, cex.col=0.7, main = deparse(substitute(x)), ...) { op <- par(mgp=c(2, .3, 0)) on.exit(par(op)) nr <- nrow(x) nc <- ncol(x) image(1:nc, 1:nr, t(x)[, nr:1], axes = FALSE, xlab = "", ylab = "", main = main, ...) axis(2, 1:nr, rev(rlab), cex.axis=cex.col, tick=FALSE, las=2) axis(1, 1:nc, clab, cex.axis=cex.row, tick=FALSE, las=2) invisible(x) }
image(yourMatrix) Andy From: Sasha Pustota > > 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 > > ______________________________________________ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > > ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html