[Rd] grid bug

Paul Murrell p.murrell at auckland.ac.nz
Tue Nov 4 00:10:13 MET 2003


Hi

I've just discovered a potentially nasty bug in grid.
If you have developed code using grid, please check whether this may 
affect your code.

The problem occurs when a numeric value is multiplied by a unit object, 
e.g., 0.5*unit(1, "inches").  The result will be WRONG if the numeric 
has length > 1, e.g., c(0.25, 0.5)*unit(1, "inches").

The problem is illustrated by the following:

       grid.segments(x0=1:3/4, y0=0.1, x1=1:3/4,
                     y1=unit(1:3/4, "npc"),
                     gp=gpar(col="grey", lwd=5))
       grid.segments(x0=1:3/4, y0=0.1, x1=1:3/4,
                     y1=1:3/4*unit(1, "npc"))

This draws three vertical bars.  The thin black bars should be the same 
heights as the thick grey bars, but they are not.

A fix for this will be in R version 1.8.1

Paul
-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/



More information about the R-devel mailing list