From peter.ruckdeschel at itwm.fraunhofer.de  Mon Feb 20 19:16:42 2012
From: peter.ruckdeschel at itwm.fraunhofer.de (Peter Ruckdeschel)
Date: Mon, 20 Feb 2012 19:16:42 +0100
Subject: [Rd] text(1:10,
 col=NA) is printed in color 1 instead of color 0 (was "is not
 transparent")
In-Reply-To: <CAC2h7usFquWNOfNMAc-Xd_fTxWP2JuQAWvHKVwhdtKz70bHpPQ@mail.gmail.com>
References: <4F422A03.8020402@itwm.fraunhofer.de>
	<CAC2h7usFquWNOfNMAc-Xd_fTxWP2JuQAWvHKVwhdtKz70bHpPQ@mail.gmail.com>
Message-ID: <4F428E0A.4000309@itwm.fraunhofer.de>

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
>



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