如何导出交互式 rgl 3D 绘图以共享或发布?
我使用 rgl 包在 R 中制作了一个交互式 3D 图.我希望能够将其发送(并保持交互)给一位同事,以便她可以在她的笔记本电脑上的会议中展示(旋转).有没有办法做到这一点?
I have made an interactive 3D plot in R using the rgl package. I would like to be able to send it (and keep it interactive) to a colleague so she can present it (rotate it) in a meeting on her laptop. Is there a way to do this?
这是我用来生成绘图的代码:
Here is the code I used to generate the plot:
这是情节:
library(rgl)
plot3d(pcaGB$x[,1:3], col=gbMeta2.5K$gbColor, type='s', size=1)
然后我使用此代码使用 writeWebGL 将其导出为 HTML,但到目前为止没有任何运气:
I am then using this code to export it to HTML using writeWebGL, but without any luck so far:
browseURL(paste("file://", writeWebGL(dir=file.path("~/Documents/", "webGL"), width=700), sep=""))
这是我在浏览器窗口中返回的内容:
This is what I get back in a browser window:
我也试过只使用 writeWebGL,但这会在目录中创建一个文件夹,其中包含一个 index.html 文件,该文件在浏览器中打开与上面相同的图像.
I've also tried using just writeWebGL but that creates a folder in the directory with an index.html file that opens the same image as above in the browser.
您可以使用 knitr 将交互式绘图导出为 html.有关详细信息,请参阅:包括带有 knitr 的交互式 3D 图形.
You can export the interactive plot to html using knitr. For the details see: including a interactive 3D figure with knitr.