# [R] persp(): add second plane (second, long question)

Nina Lieske nina at math.uni-bremen.de
Mon Mar 18 12:50:48 CET 2002

```Thank you for your replies so far.

Sorry for bothering you again, but I'm still not able to get what I need as
I don't understand all parts of the replies (just using R for easy
things....).
Is there a code for plane3d() like some of you sent me for points3d()? I was
not able to get that out of the scatterplot3d package...

What I can do is to get the x,y and z-range for the xlim,ylim and zlim so
that the two planes would fit the box (x and y  values are the same for both
(1x6vectors)). And I'm able to store the z-values in two different matrices
(6x6).

What I did then is

> xachse<-c(1:6)
> yachse<-xachse
>
> par(bg = "white")
>
> trans3d <- function(x,y,z,pmat) {
+   tmat <- t((cbind(x,y,z,1)%*% pmat))
+   list(x=tmat[1,]/tmat[4,],y=tmat[2,]/tmat[4,])
+ }
> pmat <- persp(xachse, yachse, betaon1.median.plot,zlim=c(2.75,3.30), theta
= 60, phi = 20,
+               col = "lightblue", xlab = "X", ylab = "Y", zlab = "Z",
+               ticktype="detailed")

This generates a plot for one sample of z-values with enough space for the
second plane. How do I now add the second plane?