[R] image ()

Lorenz Gygax lgygax at access.unizh.ch
Thu Dec 3 14:27:42 CET 1998

Dear all,

I am working with R Version 0.62.2  (July 10, 1998) on a SuSE Linux 5.2.

I have troubles in understanding the function image (). Can someone
enlighten me?

I'd like to draw a square image-plot (with every little part of the image
a square as well) and add some (straight) lines to it. Also, I create an
empty z matrix which I need to fill step by step. Thus I tried to find out
how exactly the image squares are fitted into the x-y axis. 

(in S-plus, one way to do it is to have x and y one integer bigger than
the dimensions of the z matrix. Thus x and y give the corner coordinates
of the little image squares. Or, x and y are the same length as the
dimensions of the z-matrix and then x and y give the center of the image

Now I don't really see how it is done in R from the help file thus I did a
simple example:

> test.mat <- matrix (1:9, ncol= 3)
> image (1:3, 1:3, test.matrix)
> iamge (1:4, 1:4, test.matrix)

both commands are executed without error.

BUT the first one splits the two axis at 1.5 and 2.5 (starting at 1 and
ending at 3) and thus not all the little image squares (or rather
rectangles) are the same size.

In the second case, again the image rectangles at the edge are smaller
than in the center and part of the plot stays empty as there are 16 fields
but only 9 values in the matrix (no complaint that the axes and the
dimensions of the matrix don't match).

If I leave out the x and y (as suggested in the help file) the image looks
the same as with 1:3, the only difference being that the scale runs from 0
to 1 (with splits at 0.25 and 0.75). 

Can I influence this behaviour and how?

Thank you for your help! Regards,
--			~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lorenz Gygax		 LGygax at amath.unizh.ch;       room: 36-L-40
			 Department of Applied Mathematics
			 University of Zuerich-Irchel
			 Winterthurerstr. 190; CH-8057 Zurich
			 voice: 41-1-635-58-52  fax: 41-1-635-57-05

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list