如何导出交互式 rgl 3D 绘图以共享或发布? [英] How to export an interactive rgl 3D Plot to share or publish?

查看:28
本文介绍了如何导出交互式 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.

这篇关于如何导出交互式 rgl 3D 绘图以共享或发布?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆