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

From: Peter Ruckdeschel <peter.ruckdeschel_at_itwm.fraunhofer.de>
Date: Mon, 20 Feb 2012 19:16:42 +0100

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 Received on Mon 20 Feb 2012 - 18:18:42 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 21 Feb 2012 - 07:20:19 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive