Re: [R] custom tick labels on image

From: Prof Brian Ripley <>
Date: Fri 07 Jul 2006 - 02:50:29 EST

On Thu, 6 Jul 2006, Pieter Provoost wrote:

> Hi,
> I'm trying to visualise a matrix using image(), and I would like to add
> the row and column names as tick labels. I tried adding an axis, but the
> problem is that this axis goes from 0 to 1 which results in labels being
> added starting at the far right end of the axis.
> image(t(data), col = terrain.colors(20), axes=FALSE)
> axis(3, at = 1:length(colnames(data)), labels=colnames(data))
> How can I do this better?

It is probably easiest to supply x and y when calling image, as in the final example on the help page. (And BTW, ncol() gives the number of columns more readily than length(colnames()).)

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list
PLEASE do read the posting guide!
Received on Fri Jul 07 04:04:07 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 Fri 07 Jul 2006 - 06:15:04 EST.

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