Hi Folks,

I'm trying to get rgl.Sweave to produce plots with transparency.
However, it just seems to produce opaque plots when pdf is the output
type.  Perhaps this is a known issue?  I'll just use .png in the
meantime, but wanted to see about this, as I didn't see it in the
documentation (though it's possible I missed it).

Thanks,
Allie




\documentclass{article}
\title {rgl test}
\usepackage{Sweave}
\begin {document}

This is a test of rgl.sweave's alpha capability.

\begin{figure}
% uncomment line below for png output (correct transparency)
% <<echo=FALSE, grdevice=rgl.Sweave, fig=TRUE, width=5, height=5,
resolution=100>>=
<<echo=FALSE, grdevice=rgl.Sweave, fig=TRUE, width=5, height=5,
resolution=100, outputtype=pdf, pdf=TRUE>>=
library(rgl)
data(volcano)
z <- 2 * volcano        # Exaggerate the relief
x <- 10 * (1:nrow(z))   # 10 meter spacing (S to N)
y <- 10 * (1:ncol(z))   # 10 meter spacing (E to W)
zlim <- range(y)
zlen <- zlim[2] - zlim[1] + 1
colorlut <- terrain.colors(zlen) # height color lookup table
col <- colorlut[ z-zlim[1]+1 ] # assign colors to heights for each point
#open3d()
surface3d(x, y, z, color=col, back="lines", alpha=0.75)
@
\end{figure}

\end{document}

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to