[Rd] Strange behaviour of image (PR#510)

Prof Brian Ripley Prof Brian Ripley <ripley@stats.ox.ac.uk>
Fri, 7 Apr 2000 17:51:47 +0100 (BST)


> Date: Fri, 7 Apr 2000 17:04:17 +0100 (BST)
> From: Jonathan Rougier <J.C.Rougier@durham.ac.uk>
> 
> Hi Peter,
> 
> On 6 Apr 2000, Peter Dalgaard BSA wrote:
> 
> > J.C.Rougier@durham.ac.uk writes:
> > 
> > > The following commands
> > > 
> > > z <- matrix(seq(0, 1, len=1000))
> > > image(z, 1, z, zlim=c(0, 1), col=gray(1:10/10))
> > > 
> > > appear to violate the image functionality as described on the
> > > help page.  As I understand it, by specifying a zlim of c(0, 1)
> > > and a colour vector of length 10, the colours should correspond
> > > to the intervals (0, 0.1), (0.1, 0.2), ..., (0.9, 1.0), this
> > > being 10 equally-spaced intervals on (0, 1).  It is clear from
> > > the image that this has not occurred.  In fact the intervals are
> > > apparently (0, 1/18), (1/18, 3/18), ..., (15/18, 17/18), (17/18,
> > > 1).  Have I misunderstood something?
> > 
> > I don't see that anything else is being promised...
> > 
> > If someone actually thought about this, then the choice might be
> > related to the behavior at peaks and troughs. (since a circle with
> > radius r looks wide compared to the region between two circles with
> > diameter n*r and (n+1)*r)
> 
> I'm not quite sure I follow.  My feeling is that the displayed behaviour
> of image is unreasonable, and, I hazard, not what most people who use
> image expect.  I think the default behaviour of image should be to give
> colour bands of equal widths, and, if I may append to the wish list, I
> woud like to be able to specify a "breaks" argument to have unequal widths
> should I so choose.

I side with Jonathan.

(1) The prototype does as JCR describes: given 64 colours it allocates
1/64th of the space to each.

(2) Setting the break points seems a good idea to me (but can always be
faked by a non-linear monotonic transformation of z, as I have done
before now).

I suggest we do add a `breaks' arg and that we do change the default
at the level of the R code, perhaps with an oldstyle parameter.
OK?

-- 
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._