[R] image() and nonsquare matrices

From: Robin Hankin <r.hankin_at_noc.soton.ac.uk>
Date: Fri 12 Jan 2007 - 10:12:35 GMT

How do I draw non-square matrices with image() and get the axes right?

Try 1:

  a <- matrix(rnorm(100),20,5)
image(1:20,1:5,a,asp=1,xlab="label here")
# No good because the axes don't touch the image

Try 2:

image(1:20,1:5,a,asp=1,axes=F,xlab="label here") axis(side=1,pos=0)
# No good because the x axis label is floating far from the x axis.

Try 3:
  image(1:20,1:5,a,asp=1,axes=F,xlab="",ylab="")   axis(side=1,pos=0)
# No good because the x axis label is absent.

How to use image() with a non-square matrix and make axes and labels appear correctly?

Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743

R-help@stat.math.ethz.ch mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Fri Jan 12 21:24:52 2007

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 12 Jan 2007 - 11:30:27 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.