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,                  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to