Re: image()

About this list Date view Thread view Subject view Author view Other groups

Subject: Re: image()
From: Martin Maechler (
Date: Mon 15 Nov 1999 - 18:38:40 EST

Message-ID: <14383.50832.260276.838244@gargle.gargle.HOWL>

>>>>> On Sun, 14 Nov 1999 23:10:26 +0000 (GMT), Prof Brian D Ripley
>>>>> <> said:

BDR> 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!).

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

Excellent, thank you!

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

yes, I do.
- If I remember properly, I even spent an hour or so to make this work in R:
 When I was porting the wavethresh package,
 one of the multiresolution plots didn't work in R, first, because image()
 didn't work for 1x1 images.

- Also, for the matter of completeness and consistency, I think this just
  should work.

BDR> At present those cases are an error.
r-devel mailing list -- Read
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To:

About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b25 : Tue 04 Jan 2000 - 14:16:10 EST