Re: [R] color2D.matplot axis names

From: Jim Lemon <>
Date: Wed, 18 Jun 2008 20:07:25 +1000

MeMooMeM wrote:
> Hi,
> I finally came up with a nice colored matrixplot, using the color2D.matplot
> function of the plotrix package. But I can't assign xtics and ytics to this
> plot. I made sure that the matrix has correct colnames() and rownames().
> Here's what I do:
> a=matrix(1:16, 4, 4)
> colnames(a) <- c("X1", "X2", "X3", X4)
> rownames(a) <- c("Y1", "Y2", "Y3", "Y4")
> color2D.matplot(a,c(0,1),c(0,0),c(0,0),show.legend=TRUE, show.values=TRUE)
> As you can see from the output of these commands, the ticks are numbers, but
> not the names.
Hi MeMooMeM,
For reasons I can't recall right at the moment, the solution to this is:

color2D.matplot(a,c(0,1),c(0,0),c(0,0),show.legend=TRUE,   show.values=TRUE,axes=FALSE)

You have reminded me that I intended to fix this and have column and row names as axis labels if they were present.

Note that your assignment of colnames fails because there are no quotes around X4.

Jim mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed 18 Jun 2008 - 11:27:17 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 18 Jun 2008 - 11:31:02 GMT.

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

list of date sections of archive