[R] NA values for "col"

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Mon Sep 27 23:43:38 CEST 2021

?text says

"...  NA values of font are replaced by par("font"), and similarly for col."

Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Mon, Sep 27, 2021 at 2:12 PM Rolf Turner <r.turner using auckland.ac.nz> wrote:
> I've just noticed what seems to me to be somewhat peculiar behaviour in
> respect of how different plotting functions treat a specification
> "col=NA".
> Consider:
> plot(1:10)
> text(4,6,labels="o",col=NA)
> points(6,4,col=NA)
> The symbol produced by the call to text() shows up (is black).
> The symbol produced by the call to points() does not appear.
> Of course if one simply does
> points(6,4)
> then the symbol appears.
> This seems to me to be a mild inconsistency.
> It is No Big Deal, and in fact doesn't matter at all (who in their
> right mind would specify col=NA?).  I only noticed this phenomenon
> because of an error I had made in some code.  I'm just curious as to
> what is going on.  Is there a reason for the difference in behaviour
> between text() and points()?  (And plot(); plot(1:10,col=NA) produces
> no points in the plot.)
> Note that the help for par() says:
> > Some functions such as lines and text accept a vector of values which
> > are recycled and may be interpreted slightly differently.
> So I guess differences in behaviour are hinted at.
> I'm still curious!
> Any thoughts from anyone?
> cheers,
> Rolf Turner
> --
> Honorary Research Fellow
> Department of Statistics
> University of Auckland
> Phone: +64-9-373-7599 ext. 88276
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list