简体   繁体   English

在R中使用线框在3d中进行绘制

[英]Plot in 3d with wireframe in R

I am trying to plot in 3d with wireframe, here is my code: 我正在尝试使用线框在3d中进行绘制,这是我的代码:

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



 ...........

Is it possible to use the wireframe or another function with these data to represent the bivariate cumulative distribution function ? 是否可以将线框或其他函数与这些数据一起使用以表示双变量累积分布函数?

Here's one way. 这是一种方法。

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

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

表面

 #plot points to verify overall shape

 scatter3D(xc,yc,bcdfa)

数据

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM