简体   繁体   English

用R语法导出Plotly

[英]Export Plotly in R syntax

So I have a lot of plotly heatmaps that I need to export to .png format. 因此,我有很多需要导出为.png格式的热图。 I have searched and found the export function. 我搜索并找到了export功能。 However when used it brings up an error about webshot . 但是,使用它会引发有关webshot的错误。

Here is an example of the kind of plots I am exporting (I have 1111 of these plots): 这是我正在导出的样地的示例(这些样地中我有1111个):

p <- plot_ly(z = volcano, type = "heatmap")

When I try the export(p, file = "plot11.png") command I get error: 当我尝试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

What should I do to trouble shoot this? 我该怎么办才能解决这个问题?

with processx package it can be done, 使用processx包可以做到,

if (!require("processx")) install.packages("processx")
orca(p, "plot11.png") ##orca is the replace of export function

if u have plot_ly account u can easily export 如果您有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")

sample ref link 样品参考链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM