persp() is not really designed to do that.
rgl has a nice interface that allows this sort of things with its
persp3d() function.
Uwe Ligges
On 07.03.2012 11:01, Simone Tenan wrote:> Hi all,
>
> I need to plot two intersecting planes in a graph. Using persp() function
> (see code below) I am not able to add a second plane with good results.
> I tried with par(new=TRUE) but the output was very poor.
> I have found some previous discussions about this point but (apparently)
> without a clear solution.
> Any advice would be appreciated.
>
> Simone Tenan
>
> ##################
> library(popbio)
> fec<-seq(0.1,2,0.1)
> delta<- seq(0,0.6,0.05)
> lambda<-matrix(0,length(fec),
> length(delta))
> S0=0.7
> S1=0.8
> S2=0.85
> S3=S2
> for (j in 1:length(delta)){
> for (i in 1:length(fec)){
> F1=0
> F2=fec[i]*0.05
> F3=fec[i]*0.3
> M<-matrix(0,3,3)
> M[1,]<-c(F1,F2*S0*(1-delta[j]),F3*S0*(1-delta[j]))
> M[2,]<-c(S1*(1-delta[j]),0,0)
> M[3,]<-c(0,S2*(1-delta[j]),S3*(1-delta[j]))
> lambda[i,j]<-eigen.analysis(M)$lambda
> }
> }
> res<- persp(fec,delta,lambda,xlim = range(fec), ylim >
range(delta),shade=T,theta = 230, phi = 20, expand = 0.8, col >
"lightblue",ticktype="detailed")
> lines(trans3d(c(2,2,0.1,0.1,2), c(0.6,0,0,0.6,0.6),
> c(1,1,1,1,1),res),col="blue")
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.