2014-09-12 102 views
0

我试图与线框3D绘制线框,这里是我的代码:情节3D与R中

mecdf = function (nr, nc, x, u) # mecdf is the bivariate cumulative empiric function 
{ k = rep (TRUE, nr) 
    for (j in 1:nc) k = k & (x [,j] <= u [j]) 
    sum (k)/nr 
} 

xc = round(runif(100), 2) 
yc = round(runif(100), 2) 
Da = cbind(xc, yc) 

bcdfa<-rep(NA,100) 
for (i in 1:100) {bcdfa[i]=mecdf(nrow(Da),ncol(Da),Da,Da[i,])}  
bcdfa 

x<-cbind(xc,yc,bcdfa) # bcdfa is the value of the bcdfa in every (xc,yc) point 



........... 

是否有可能使用线框或与这些数据的另一个函数来表示二元累计分配功能 ?

+0

是你的问题 “找我的包'lattice'” 抑或是 “如何转储这些变量到函数'格:wireframe'”? – 2014-09-12 11:48:28

+0

我的问题是如何将这些变量转储到函数lattice:wireframe。谢谢 – 2014-09-12 11:56:29

+0

@QuintinCopete请编辑您的问题,使其更清晰。 – 2014-09-12 12:02:59

回答

0

这是一种方法。

library(akima) 
library(plot3D) 
bcfoo<-interp(xc,yc,bcdfa) 

persp3D(bcfoo$x,bcfoo$y,bcfoo$z) 

the surface

#plot points to verify overall shape 

scatter3D(xc,yc,bcdfa) 

the data

+0

非常感谢 – 2014-09-15 07:07:30