[R] Alpha values

Paul Murrell p.murrell at auckland.ac.nz
Wed Nov 12 21:25:26 CET 2003


Hi

The only other current possibility I know of is by producing grid 
graphics output in SVG format.  A simple example ...

library(grid)
# Get from http://www.stat.auckland.ac.nz/~paul/
library(gridSVG)
# Important
push.viewport(viewport(gp=gpar(col="black", fill=NA)))
grid.circle(x=0.4, r=0.3, gp=gpar(fill="green", alpha=0.3))
grid.circle(x=0.6, r=0.3, gp=gpar(fill="red", alpha=0.3))
# Important
pop.viewport()
# Produce files test.svg and test.svg.html
# test.svg.html can be viewed by, e.g., Adobe SVG Viewer 3.0 in IE
gridToSVG("test.svg")

Of course, you have to use grid, and gridSVG (which is very 
experimental), and you only get SVG, so it depends on how badly you want 
transparency.

Paul


Prof Brian Ripley wrote:
> Yes, but currently only alpha=0 and alpha=255 are supported by the
> available devices that I know of (and I introduced this).
> 
> Adding alpha-level support is complicated for the devices people normally
> use, although it would be trivial in PDF1.4.
> 
> On Wed, 12 Nov 2003, Crispin Miller wrote:
> 
> 
>>Does anyone know whether it is possible to construct a colour for
>>plotting with an alpha value as well as simply specifying rgb values?
> 
> 


-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/




More information about the R-help mailing list