[Rd] text(1:10, col=NA) is printed in color 1 instead of color 0 (was "is not transparent")

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Feb 21 01:14:53 CET 2012


The documentation is out of date (and contradictory for cex).
Nowadays NULL and NA for col and font correspond to the par() values, 
and for cex correspond to 1.0.

So it is in fact _plotted_ in par("col"), which by default is 1.

On 20/02/2012 18:16, Peter Ruckdeschel wrote:
> Am 20.02.2012 15:22, schrieb Kasper Daniel Hansen:
>> Peter,
>>
>> not all devices support transparency.  My guess is that you are
>> plotting to a device which does not, but it is hard to know from your
>> email.
>>
>> Kasper
>>
>
> In the meantime Kasper and I had some mail exchange offline.
>
> @Kasper: thanks again for your explanations and hopefully it is oK
>           for you if I put this clarifying online
>
> It seems my original subject was a bit misleading, as I am not
> really interested in achieving transparency (which I know is
> system-dependent) but rather in the behavior, that
>
> text(<some input>, col = NA)
>
> should not do anything --- or, more useful, if you have vectorized input
> and col is vectorized, too, the NA-coordinates are not printed (as is
> what I read from the help page to par() ).
>
> The non-printing behavior is achievable already with 0 color values, and
> with named color "transparent", but not for NA-values.
>
> This effect seems to be device independent, at least I have checked it
> for the windows, pdf, and jpeg devices under Windows and in the default
> graphics device under Linux.
>
> Any suggestions welcome,
> Peter
>
>> On Mon, Feb 20, 2012 at 6:09 AM, Peter Ruckdeschel
>> <peter.ruckdeschel at itwm.fraunhofer.de>  wrote:
>>> Maybe I am missing something, but according to the help page
>>> to par (section "Color Specification"), which is referred to in the
>>> help to text argument col:
>>>
>>> ‘"transparent"’ or (integer) ‘NA’ is _transparent_,
>>> useful for filled areas (such as the background!), and just
>>> invisible for things like lines or text.
>>>
>>> but:
>>>
>>> col0<- as.integer(NA)
>>> is.integer(col0)
>>> ### is this coercing to "integer" necessary?
>>> plot(1:10)
>>> text(1:10, col=col0)
>>> ### text is plotted
>>>
>>> ##whereas
>>> plot(1:10)
>>> text(1:10, col="transparent")
>>> ### text is not plotted
>>>
>>> # Of course, this is not terribly urgent, as a color value of 0 also
>>> plot(1:10)
>>> text(1:10, col=0)
>>> ### text is not plotted
>>>
>>> Best, Peter
>>>
>>> ______________________________________________
>>> R-devel at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel


-- 
Brian D. Ripley,                  ripley at 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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list