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. Thank you so much in advance! -- View this message in context: http://www.nabble.com/color2D.matplot-axis-names-tp17948688p17948688.html Sent from the R help mailing list archive at Nabble.com.
Looking into the color2D.matplot code showsthat this is by design. You might want to contact the package maintainer and send suggestions how to patch the function (or better, send the patch itself) in order to show appropriate labels. Of course, for a worksround, disable axes color2D.matplot(a,c(0,1),c(0,0),c(0,0),show.legend=TRUE, show.values=TRUE, axes=FALSE) and add manually constructed axes by the axis() function later on. Uwe Ligges 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. > > Thank you so much in advance! > >
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) axis(1,at=0.5:3.5,labels=colnames(a)) axis(2,at=0.5:3.5,labels=rownames(a)) 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