From ripley@stats.ox.ac.uk  Sun Nov 14 23:10:26 1999
From: ripley@stats.ox.ac.uk (Prof Brian D Ripley)
Date: Sun, 14 Nov 1999 23:10:26 +0000 (GMT)
Subject: image()
In-Reply-To: <Pine.GSO.3.96.991113123408.4357A-100000@laplace>
Message-ID: <Pine.GSO.4.05.9911142306110.2464-100000@auk.stats>

On Sat, 13 Nov 1999, Jonathan Rougier wrote:

> May I raise the issue of the behaviour of image()?  In image() dim(z) is
> supposed to be c(length(x), length(y)).  This suggests that the user is
> supplying the midpoints of the rectangles.  For all but the outer
> rectangles this is true.  The outer rectangles, however, are only
> displayed in half width.  So it is not possible to show correctly an image
> plot of equally-spaced abscissa.  I would hazard a guess that these kinds
> of plots make up the bulk of calls to image() either directly or after a
> simple transformation (eg starting with boundary values rather than
> midpoints).
> 
> Can I suggest that the code for image() be modified to show full
> rectangles for all values on the basis that x and y are midpoints? 
> According to my code for R (which is a bit out of date!) the minimum
> change would require 4 lines to be modified in the function do_image of
> plot3d.c.  The alternative, which I think would be more transparent, would
> be to call the function do_image with boundary values having previously
> made the appropriate calculations in image() according to whether
> midpoints or boundary values are supplied.  Something like this happens in
> S+ (although not very transparently!).

I needed this in hurry this weekend for some fMRI plots. I've altered
image so that if z is m x n, x can be of length m or m+1 and y of length n
or n+1.  If x is of length m it supplies the midpoints, if of length m+1
it supplies the boundaries of the cells. (All S compatible.)  The internal
call is made with the boundary values.  The outer cells are plotted
in full width.

The one change is if m=1 or n=1. I reckon that is an error, but S
and R previously filled the whole width. Does anyone want that behaviour?
At present those cases are an error.


-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


image()
Prof Brian D Ripley