r plotly :: save_image / kaleido:从r不起作用的静态导出

发布于 2025-01-27 21:41:59 字数 2006 浏览 4 评论 0原文

我正在尝试使用plotly :: save_image()从绘图图中保存静态图像,但是每次运行此功能时,rstudio都会获得堆栈(繁忙的红色图标),并且需要重新启动。没有显示任何错误消息。

我已经运行以下命令,它们似乎都已正确安装:

install.packages('noticulate')
网状:: install_miniconda()
网状:: conda_install('r-reticulate','python-kaleido')
网状:: conda_install('r-reticulate','plotly',channel ='plotly')
网状:: use_miniconda('r-retiCulate')

rstudio在运行save_image(p,tmp)时在繁忙(红色圆圈)状态下堆叠:

p< - plot_ly(x = 1:10) )
save_image(p,“ test.png”)


谢谢您的帮助


XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Additional information including sessionInfo() output:


系统类型:64位操作系统,基于X64的处理器

版本:Windows 10 Enterprise
版本:21H2
安装在:29/04/2022

情节版本:4.10.0
网状版本:1.24


R版本4.2.0(2022-04-22 UCRT)
平台:X86_64-W64-MINGW32/X64(64位)
运行下:Windows 10 X64(构建19044)

矩阵产品:默认

语言环境:
lc_collat​​e = English_new Zealand.utf8
lc_ctype = English_new Zealand.utf8

lc_monetary = English_new Zealand.utf8
lc_numeric = C

lc_time = English_new Zealand.utf8


附加的基本软件包:
统计数据
图形
grdevices
utils
数据集
方法
base


其他附件:
plotly_4.10.0
ggplot2_3.3.5

通过命名空间加载(并且未连接):
Pillar_1.7.0
Compiler_4.2.0
tools_4.2.0
digest_0.6.29
viridislite_0.4.4.0.4.0
> tibble_3.1.6
gtable_0.3.0
pkgconfig_2.0.3
rlang_1.0.2
cli_3.3.0
dbi_1.1.1.1.1.2
yaml_2.3.5 .1.0
httr_1.4.2
withr_2.5.0
dplyr_1.0.8
knitr_1.39
generics_0.1.1.2
vctrs_0.4.4.1

tidySelect_1.1.2
glue_1.6.2
data.table_1.14.2 r6_2.5.1
fandi_1.0.0.3
rmarkdown_2.14
bookdown_0.0.26
tidyr_1.2.0
purrr_0.3.4
magrittr_2.0.3
scales_1.2.0
ellipsis_0.3.2
htmltools_0.5.2.2
assertthat_0.2.1.2.1
colorspace_2.0-3
utf8_1.2.2
lazyeval_0.2.2
munsell_0.5.0
crayon_1.5.1

I am trying to save a static image from a plotly graph using plotly::save_image(), but everytime I run this function, Rstudio gets stack (busy red icon) and needs to be restarted. There is not any error message displayed.

I have run the following commands and they all seem to have been installed correctly:

install.packages('reticulate')
reticulate::install_miniconda()
reticulate::conda_install('r-reticulate', 'python-kaleido')
reticulate::conda_install('r-reticulate', 'plotly', channel = 'plotly')
reticulate::use_miniconda('r-reticulate')

RStudio gets stack in a busy (red circle) state when save_image(p, tmp) is run:

p <- plot_ly(x = 1:10)
save_image(p, "test.png")

Thank you for your help

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Additional information including sessionInfo() output:

System type : 64-bit operating system, x64-based processor

Edition : Windows 10 Enterprise

version : 21H2

Installed on: 29/‎04/‎2022

plotly version : 4.10.0

reticulate version : 1.24

R version 4.2.0 (2022-04-22 ucrt)

Platform: x86_64-w64-mingw32/x64 (64-bit)

Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale:

LC_COLLATE=English_New Zealand.utf8
LC_CTYPE=English_New Zealand.utf8

LC_MONETARY=English_New Zealand.utf8
LC_NUMERIC=C

LC_TIME=English_New Zealand.utf8

attached base packages:

stats
graphics
grDevices
utils
datasets
methods
base

other attached packages:

plotly_4.10.0
ggplot2_3.3.5

loaded via a namespace (and not attached):

pillar_1.7.0
compiler_4.2.0
tools_4.2.0
digest_0.6.29
viridisLite_0.4.0
jsonlite_1.8.0
evaluate_0.15
lifecycle_1.0.1
tibble_3.1.6
gtable_0.3.0
pkgconfig_2.0.3
rlang_1.0.2
cli_3.3.0
DBI_1.1.2
yaml_2.3.5
xfun_0.30
fastmap_1.1.0
httr_1.4.2
withr_2.5.0
dplyr_1.0.8
knitr_1.39
generics_0.1.2
vctrs_0.4.1
htmlwidgets_1.5.4
grid_4.2.0
tidyselect_1.1.2
glue_1.6.2
data.table_1.14.2 R6_2.5.1
fansi_1.0.3
rmarkdown_2.14
bookdown_0.26
tidyr_1.2.0
purrr_0.3.4
magrittr_2.0.3
scales_1.2.0
ellipsis_0.3.2
htmltools_0.5.2
assertthat_0.2.1
colorspace_2.0-3
utf8_1.2.2
lazyeval_0.2.2
munsell_0.5.0
crayon_1.5.1

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

念三年u 2025-02-03 21:41:59

我希望这仍然有帮助,我认为我找到了解决方案。显然,在Windows 10和11中,您需要旧版本的Kaleido。
为了获得它,而不是:reticulate :: conda_install('r-retiCulate','python-kaleido')
尝试网状:: conda_install('r-retiCulate','python-kaleido == 0.1。*')

I hope this still helps, I think I found the solution. Apparently in windows 10 and 11, you need an older version of kaleido.
To get it, instead of: reticulate::conda_install('r-reticulate', 'python-kaleido')
try reticulate::conda_install('r-reticulate', 'python-kaleido==0.1.*')

翻了热茶 2025-02-03 21:41:59

我认为您需要在代码中添加此行:

reticulate::py_run_string("import sys")

I think you need to add this line in your code:

reticulate::py_run_string("import sys")
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文