所以我有很多情节热图,我需要导出为.png格式。我搜索并找到了export
功能。但是当使用它时会出现关于webshot
的错误。
这是我正在导出的那种情节的一个例子(我有1111个这样的情节):
p <- plot_ly(z = volcano, type = "heatmap")
当我尝试export(p, file = "plot11.png")
命令时,我收到错误:
Could not load file:///datatwo/13483885$/GCA%20Capstone/plotly28b83ffb3228.html
Error in webshot::webshot(f, file, ...) :
webshot.js returned failure value: 1
我该怎么做才能解决这个问题呢?
用processx
包可以做到,
if (!require("processx")) install.packages("processx")
orca(p, "plot11.png") ##orca is the replace of export function
如果你有plot_ly帐户,你可以轻松导出
Sys.setenv("plotly_username" = "YOUR USER NAME")
Sys.setenv("plotly_api_key" = "YOUR API KEY")
plotly_IMAGE(p, format = "png", out_file = "output.png")