[R] two perspective plots in in plot
Duncan Murdoch
murdoch at stats.uwo.ca
Sat Feb 10 03:13:37 CET 2007
On 2/9/2007 4:16 PM, Greg Snow wrote:
> The rgl package has an rgl.postscript function that should do that for
> you (I think there was a bug discovered and fixed recently, so make sure
> to get the latest version).
Yes, that's right. If you see any other bugs, please let me know. (One
known bug is not in rgl: Mac OSX Preview won't show .pdf files created
by rgl properly. That's an Apple bug, not an rgl bug. Please complain
to them: it's been known for more than a year.)
Duncan Murdoch
>
> --
> Gregory (Greg) L. Snow Ph.D.
> Statistical Data Center
> Intermountain Healthcare
> greg.snow at intermountainmail.org
> (801) 408-8111
>
>
>
>
>
>
> ________________________________
>
> From: Roland Rau [mailto:roland.rproject at gmail.com]
> Sent: Friday, February 09, 2007 12:46 PM
> To: Duncan Murdoch
> Cc: Greg Snow; r-help
> Subject: Re: [R] two perspective plots in in plot
>
>
> Thanks Duncan and Greg.
> My current solution is to use the rgl-package.
> Is there an easy way to obtain a screenshot in eps- or
> pdf-Format from such an rgl-window?
> I saw the rgl.snapshot function but it does not provide this
> format.
>
> So far, I take a snapshot, save it as jpeg and convert it to eps
> via jpeg2ps.exe
> Maybe not the most elegant way but the results are better than I
> anticipated.
>
> Thanks,
> Roland
>
>
>
>
> On 2/9/07, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
>
> On 2/9/2007 1:11 PM, Greg Snow wrote:
> > Probably the easiest way is to use the "wireframe"
> function in the
> > lattice package. The second example in the help shows
> 2 surfaces (you
> > do need to combine the data into a single data frame).
>
> >
> > If you really want to use the "persp" function, then
> you could create
> > the first plot, then call "par(new=TRUE)" and then do
> the 2nd plot, but
> > that would take a lot of thinking to get the axes and
> scales to line up
> > properly and make it look good.
>
> Another alternative is to use the persp3d function and
> surface3d
> functions in the rgl package. It would be quite tricky
> to get persp to
> handle hidden surfaces properly, whereas rgl will just
> do it (as long as
> neither is transparent. Transparency is hard.)
>
> For example, after running example(persp) so that x, y,
> and z contain
> values that were just used in
>
> persp(x, y, z, theta = 135, phi = 30, col = "green3",
> scale = FALSE,
> ltheta = -120, shade = 0.75, border = NA, box =
> FALSE)
>
> you can run
>
> library(rgl)
>
> persp3d(x,y,z, col="green3", aspect="iso", axes=FALSE,
> box=FALSE,
> xlab="", ylab="", zlab="")
>
> persp3d(x,y,(z + mean(z))/2, col="red", add=TRUE)
>
> and then rotate the surfaces to the desired viewing
> angle.
>
> Duncan Murdoch
>
>
>
>
More information about the R-help
mailing list