[R] possible bug in ggplot2 v0.5.2???

hadley wickham h.wickham at gmail.com
Mon Jul 9 16:47:43 CEST 2007


On 7/6/07, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
> On Wed, 4 Jul 2007, hadley wickham wrote:
>
> > On 7/4/07, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
> >> On Tue, 3 Jul 2007, hadley wickham wrote:
> >>
> >> > Hi Stephane,
> >> >
> >> > The problem is that the windows graphics device doesn't support
> >> > transparent colours.  You can get around this in two ways:
> >>
> >> It certainly does!  Try col="transparent" (and perhaps consult your
> >> dictionary).  It was news to me that the windows() graphics device worked
> >> on
> >> Linux i586.
> >
> > Well my dictionary defines transparent as "allowing light to pass
> > through so that objects behind can be distinctly seen" which I believe
> > applies here (ie. stained glass windows and blue points with alpha 0.5
> > are both transparent).  What does your dictionary say?
>
> Not quite the same, but even by your definition col="transparent" is
> transparent.  In this context
>
> http://en.wikipedia.org/wiki/Transparency_%28graphic%29
>
> seems more pertinent.

col="transparent" is transparent by any reasonable definition, but
does it make sense to claim that a graphics device "supports"
transparency?  How can you tell the difference between a transparent
object and nothing?

> >> What it does not support as yet is translucent colours, and that is a
> >> restriction imposed by Windows (translucency support was introduced for
> >> Windows XP, and we still try to support older versions of Windows, unlike
> >> the MacOS people).  I have been working on a workaround, so translucency
> >> support is likely to be implemented in R 2.6.0 for users of XP or later.
> >
> > I am confused by your implication that windows (prior to XP) does not
> > support translucency.  Perhaps it is not supported at the operating
> > system level, but it has certainly been available at the application
> > level for a very long time.
>
> Really? It's hard to reply to unspecific assertions.  But remember XP has
> been out since 2001, almost as long as PDF has supported translucency.

Yes, I agree, and thank you for providing some support to your
statements.  Java has supported transparency since 1.2 (with the
Graphics2D class), and was released on Dec 4, 1998, so certainly some
applications were drawing transparent graphics on windows.

> >> Given that neither of the two main screen devices and neither of the
> >> standard print devices support translucency, the subject line looks
> >> correct to me: the problem surely lies in the assumptions made in ggplot2.
> >
> > The features of the windows and X11 devices clearly lag behind the
> > quartz and pdf devices.  I can program for the lowest common
> > denominator or I can use modern features that support the tasks I am
> > working on.  I choose the later, and it is certainly your prerogative
> > to declare that a bug in me.
>
> I think to make undocumented assumptions about the environment is unkind
> to your would-be users.  Ideally the graphics devices would detect and

I have tried to point that out in most places where I used
alpha-blending in the documentation, but I did miss a few.  I think
part of my job is to educate users about what is possible with R, even
though it might be currently available for their default set up.

> report that, but that is not how support for semi-transparency was added.
> As a by-product of adding limited translucency support on the windows()
> family of devices, they do now warn.

That's great news.

> You also need to check that the extra features work correctly.  I found
> some problems with all the devices I tried that support translucency (or
> at least with device+viewer combinations for pdf and svg).  Issues include
> whether translucent fills are rendered at all, blending translucent
> colours with transparent backgrounds, and the model used (is it the light
> intensity or the perceptual colours that are being blended?).

Could you provide more details about these bugs so that I can look
into the implications for my code?  I haven't seen any problems with
preview or acrobat on the mac.

Regards,

Hadley



More information about the R-help mailing list