Skip to content

image() with all NAs fails (PR#8228)

3 messages · Duncan Murdoch, Brian Ripley

#
On 10/20/2005 12:41 PM, barry.rowlingson at gmail.com wrote:
I agree, though I think the warnings are reasonable and a fix shouldn't 
remove them.  However, I'm not sure what the fix should be.  There's a 
test in image.default

         if (any(!is.finite(zlim)) || diff(zlim) < 0)
             stop("invalid z limits")


that is throwing the error.  We want the error if a user specifies 
diff(zlim) < 0 or non-finite z limits, we just don't want it if all the 
z's are NA.  But a test all(is.na(z)) looks a bit expensive for such a 
rare case.

Maybe the solution is to document this limitation?  Users can get the 
all transparent image by explicitly specifying zlim.  Folks who might 
accidentally pass in all missing data can test for it themselves.

Duncan Murdoch
#
On Thu, 20 Oct 2005 murdoch at stats.uwo.ca wrote:

            
It is not actually documented that zlim can be omitted (something we need 
to fix too).  Why not just add a check for zlim not being missing to that 
test?
#
Prof Brian Ripley wrote:
Works fine, thanks for the suggestion.  I'll commit if you haven't already.

Duncan Murdoch

Duncan