[R] Changing the ranges for the axis in image()

Sundar Dorai-Raj sundar.dorai-raj at pdf.com
Tue Jan 11 16:01:31 CET 2005



Costas Vorlow wrote:

> Dear all,
> 
> I can not find/understand the solution to this from the help pages:
> 
> Say we have the following script:
> 
> x<-matrix(c(1,1,0,1,0,1,0,1,1),3,3)
> image(x)
> 
> How can I change the ranges on the vertical and horizontal axis to a 
> range of my own or at least place a box frame around the image if I 
> choose to use "axes=FALSE"?
> 
> Apologies for such a bsic question and thanks beforehand for your answers.
> 

 From ?image:

  ## Default S3 method:
      image(x, y, z, zlim, xlim, ylim, col = heat.colors(12),
            add = FALSE, xaxs = "i", yaxs = "i", xlab, ylab,
            breaks, oldstyle = FALSE, ...)


Unless I misunderstood your question, the zlim, xlim, and ylim arguments 
should give you what you want.

--sundar




More information about the R-help mailing list