2017-02-09 72 views
0

我有一些从plot3D到plot3Drgl的图转换的问题。points3Drgl not display

这会产生阴谋没有问题

require(plot3D) 
persp3D(z=matrix(runif(100),nrow=10, ncol=10), clab = "m", shade = 0.2, 
col="#DDDDDD", colkey = FALSE, theta=20, phi=30, plot=FALSE, zlim = c(0,2)) 
points3D(x=0.5,y=0.5,z=1.5, col="#FF0000", add=TRUE, plot=TRUE, pch = 20, cex = 2) 

使用plot3Drgl同样的方法将引发一个错误:

require("plot3Drgl") 
persp3Drgl(z=matrix(runif(100),nrow=10, ncol=10), clab = "m", shade = 0.2, 
col="#DDDDDD", colkey = FALSE, theta=20, phi=30, plot=FALSE, zlim = c(0,2)) 
points3Drgl(x=0.5,y=0.5,z=1.5, col="#FF0000", add=TRUE, plot=TRUE, pch = 20, cex = 2) 

我得到的错误是:

所有我想要的这里要实现的是将单点添加到3D曲面。

在此先感谢

MJ

回答

1

我不是PLOT3D格式的专家,但以下的帮助?points3Drgl应该给你一个答案:

The first step in 3D rgl plotting consists in calling the corresponding 3-D function from package plot3D with argument plot set to FALSE.

The next step is to create a 3-D rgl plot, by calling plotrgl.

于是打电话给你的正常plot3D功能,与plot = F然后简单地plotrgl()

library(plot3D) 
library(plot3Drgl) 
persp3D(z=matrix(runif(100),nrow=10, ncol=10), clab = "m", shade = 0.2, 
col="#DDDDDD", colkey = FALSE, theta=20, phi=30, plot=FALSE, zlim = c(0,2)) 
points3D(x=0.5,y=0.5,z=1.5, col="#FF0000", add=TRUE, plot=FALSE, pch = 20, cex = 2) 
plotrgl() 
+0

感谢它的工作! –