为什么plotly::export() 在 Ubuntu 22.04 上失败?

问题描述 投票:0回答:1

这曾经在 Ubuntu 20.04 上运行,但现在在 Ubuntu 22.04 中抛出错误。

# plotly 4.10.4
plotly_plot <- plotly::plot_ly(data = mtcars,
                               x = ~mpg, y = ~wt,
                               type = "scatter", mode = "markers")

plotly::export(p = plotly_plot, file = "myplot.png")

抛出错误:

[WARNING] Deprecated: --self-contained. use --embed-resources --standalone
Error in webshot::webshot(f, file, ...) : 
  webshot.js returned failure value: 1
In addition: Warning message:
'plotly::export' is deprecated.
Use 'orca' instead.
See help("Deprecated") 
r ubuntu plotly
1个回答
0
投票

显然这与 Ubuntu 20.04 和 22.04 之间的 openssl 更改有关。可以通过执行以下操作来实现解决方法:

plotly_plot <- plotly::plot_ly(data = mtcars,
                               x = ~mpg, y = ~wt,
                               type = "scatter", mode = "markers")

Sys.setenv(OPENSSL_CONF = "/dev/null")
plotly::export(p = plotly_plot, file = "myplot.png")
Sys.unsetenv("OPENSSL_CONF")
© www.soinside.com 2019 - 2024. All rights reserved.