[R] transparent surface in rgl

Duncan Murdoch murdoch at stats.uwo.ca
Wed Oct 5 17:33:47 CEST 2005


On 10/5/2005 11:10 AM, Prof Brian Ripley wrote:
> On Wed, 5 Oct 2005, Duncan Murdoch wrote:
> 
>> On 10/5/2005 9:31 AM, Prof. Paul R. Fisher wrote:
>>> Hi all
>>> I am a complete newbie to this list (just subscribed) and a newcomer to
>>> R (an S user from olden times). I have been using scatter3d to create a
>>> 3d scatter plot with surface. The graphic is created within the rgl
>>> package and I have used rgl.postscript to export it so I can generate a
>>> publication quality image. My problem is that the plotted surface is no
>>> longer transparent in the postscript output ie. the rgl.spheres that are
>>> behind the surface disappear in the postscript image. Can't seem to find
>>> any info on this anywhere. Am I doing something wrong? Is there an easy fix?
>>
>> I think Postscript doesn't support transparency (or at least the version
>> of Postscript that the rgl.postcript function targets doesn't support
>> it).  You may have to export a bitmapped format using the rgl.snapshot()
>> function.  If your original window is very large this may give you good
>> enough quality.
> 
> Common PostScript (level 2) does not support either full or partial 
> transparency (and I guess partial transparency is meant here or the 
> surface could just not be plotted).  It would be good to have a rgl.pdf 
> which did.  These days PDF is the `portable PostScript' and since version 
> 1.4 has had alpha-channel supoort.
> 
> Ref:
> 
> http://en.wikipedia.org/wiki/Transparent_pixels#Transparency_in_PostScript
> 
> 

The library we use (GL2PS) apparently supports PDF output, and that's 
one of the format options for rgl.postscript(), so maybe we already do 
support that.  I haven't tried it.

Duncan Murdoch




More information about the R-help mailing list