我是R的业余爱好者,想在R中绘制两个三维图并进行比较。例如,这是我的R代码:
theta <- 0.3
f <- function(u,v,theta=0.5){return(1/(1-theta*u*v-theta*(1-theta*u*v)^(-2)*(1-2*u-2*v+3*u*v+(1-theta*u*v)^(-3)*2*theta^2*u*v*(1-u)*(1-v))))}
x<- seq(0,1,length=20)
y<-x
z<-outer(x,y,Vectorize(f))
z[is.na(z)]<-1
op<-par(bg = "white")
persp(x,y,z,theta=40, phi=30, expand = 0.5,ltheta=120,shade =0.1, col="tomato",zlim=c(0,2),main="", zlab="",xlab="X", ylab="Y")
z2<-matrix(rep(1,c(20*20)),ncol=20)
par(new=TRUE)
persp(x,y, z2, theta = 40, phi = 30, expand = 0.5, col = NA, border="lightgreen", zlab="",zlim=c(0,2))
问题是,我无法从图中清楚地看到哪一部分,f的点大于1,反之亦然。我想让这更加明显。任何建议都将不胜感激。