1

我正在尝试使用 WrtieWebGL 函数导出使用 rgl 包中的 plot3d 函数制作的 3D 绘图以进行 Web 查看。我不太了解 WriteWebGL 文档中的示例,因为它保存到临时目录。有人可以提供一个有关如何使用此功能的示例和/或指出我的使用错误吗?感谢您的时间和帮助。

   attach(dataset1)       
   plot3d(Days_Prep_Time,ACT_Score,Coffee,size=5,col="blue", type="s")
   writeWebGL(dir = "webGL", filename = file.path(dir, "index.html"), 
   template = system.file(file.path("WebGL", "template.html"), package = "rgl",
   snapshot = TRUE, font = "Arial")

我收到以下错误:

   Error in writeWebGL(dir = "webGL", filename = file.path(dir, "index.html"),  : 
   template ‘’ does not contain %WebGL%
   In addition: Warning message:
   In file(con, "r") :
   file("") only supports open = "w+" and open = "w+b": using the former
4

1 回答 1

0

您正在将snapshotandfont参数添加到system.file函数,而不是writeWebGL函数:

writeWebGL(dir = "webGL", filename = file.path(dir, "index.html"), 
template = system.file(file.path("WebGL", "template.html"), package = "rgl"),
snapshot = TRUE, font = "Arial")

特别要注意的是

system.file(file.path("WebGL", "template.html"), package = "rgl")

从控制台返回正确的路径,而

system.file(file.path("WebGL", "template.html"), package = "rgl", snapshot = TRUE, font = "Arial")

返回""

于 2014-04-05T17:36:44.573 回答