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

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Jul 6 08:12:27 CEST 2007


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.

>> 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.

One possibility is that you are talking about game-type applications, 
which have had alpha-blending for a long time via DirectX.  However, that 
was an add-on for a long time, is a function of the graphics card and is 
normally done on the GPU.

The standard Windows way of plotting is GDI, which is a vector painting 
language like postscript.  Like postscript, it also supports bitmaps but 
using them loses a lot of the flexibility.  Alpha blending of bitmaps was 
added for Windows 98, 2000 and later, but not for all devices: in 
particular not for metafiles and optionally for printers (and none of the 
printer drivers I have support it).  GDI+ (introduced with XP) adds 
translucency, but how widely it is supported is unclear to me.

For example, Cairo internally uses alpha-blending of bitmaps, but excludes 
Windows 98 as too buggy.  I've chosen to support Win2000 and later in 
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 
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.

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?).

-- 
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-help mailing list