From maechler at stat.math.ethz.ch  Wed May 12 16:05:45 2004
From: maechler at stat.math.ethz.ch (maechler@stat.math.ethz.ch)
Date: Wed May 12 16:05:47 2004
Subject: [Rd] points(*, pch=NA) does *not* not draw the point (PR#6876)
Message-ID: <20040512140545.300C8EDF1@slim.kubism.ku.dk>

We say in ?points  that 'pch' (among others) can be set to NA
for omitting a point.

While this works in cases where there's at least one point left
to draw, it fails in a simple case like this :

> plot(1, pch = NA)
Error in plot.xy(xy.coords(x, y), type = type, pch = pch, col = col, bg = bg,  : 
	invalid plotting symbol

Both in R-patched or R-devel.
A simple workaround {hinting at how to fix the C code} is

> plot(1, pch = as.integer(NA))

So this is easily fixable (and I'll commit a patch soon).

----

A bit more problematic *) but not a bug in a very strict sense
is the following : 

 > plot(1, pch = as.character(NA))
and
 > plot(1:4, pch=c("o",".", NA, "x"))

which are identical to

 > plot(1, pch = "N")
and
 > plot(1:4, pch=c("o",".", "N", "x"))

but should either produce a warning (additional to using "N") or
rather also treat the NA as "missing", i.e., not drawing a point.


Martin Maechler


---------------
*) because this isn't spotted when used in a context of
   plotting many things


[Rd] points(*, pch=NA) does *not* not draw the point (PR#6876)
maechler@stat.math.ethz.ch