我有变量x,y,z,它在用以下方法绘制时形成了点云:
library(plot3D)
plot3d(x,y,z)我在他们身上做了个定位
myfit = locfit(y~lp(x,z),maxk=200)我知道这会给我一条曲线,它穿过空间最密集的区域。
如何在plot3d / RGL中绘制这条曲线?
发布于 2014-06-26 01:04:47
使用surface3d。X和y是边距的向量,z是矩阵:
require(locfit)
fit <- locfit(NOx~lp(E,C,nn=0.5,scale=0), data=ethanol)
plot(locfit) # there is an ordinary contour plot method for locfit objects.
require(rgl)
open3d()
surface3d( x=seq(0.5, 1.3, by=0.1), y=seq(7.5,18,by=.5) ,
z= matrix( predict(fit, newdata=
expand.grid(E=seq(0.5, 1.3, by=0.1),
C=seq(7.5,18,by=.5) ) ) ),
,nrow= length(seq(0.5, 1.3, by=0.1)) ,
ncol= length(seq(7.5,18,by=.5) ) ,
xlim=c(.5, 1.3) )
# grab and spin实际上,我发现等高线图信息更丰富,但3d图形也可能很有用。
https://stackoverflow.com/questions/24418020
复制相似问题