我不知道要顺利运行 rgl 缺少什么。我的代码和输出:
pacman::p_load("rgl", "scales", "magick","webshot2")
rgl::plot3d(1:20, 1:20, 1:20)
snapshot3d("~/snap.png", fmt = "png")
movie3d(spin3d(axis=c(0,0,1), rpm=), duration=2, movie="3D-SPIN", verbose=TRUE, type="gif",fps = 2)
输出:
> pacman::p_load("rgl", "scales", "magick","webshot2")
> rgl::plot3d(1:20, 1:20, 1:20)
> snapshot3d("~/snap.png", fmt = "png")
Error : Chromote: timed out waiting for event Page.loadEventFired
Warning: webshot2::webshot() failed; trying rgl.snapshot()Warning: this build of rgl does not support snapshots
> movie3d(spin3d(axis=c(0,0,1), rpm=), duration=2, movie="3D-SPIN", verbose=TRUE, type="gif",fps = 2)
Error : Chromote: timed out waiting for event Page.loadEventFired
Error : Chromote: timed out waiting for event Page.loadEventFired: this build of rgl does not support snapshotsWriting '3D-SPIN001.png'
Error : Chromote: timed out waiting for event Page.loadEventFired: this build of rgl does not support snapshotsWriting '3D-SPIN002.png'
Error : Chromote: timed out waiting for event Page.loadEventFired: this build of rgl does not support snapshotsWriting '3D-SPIN003.png'
Error : Chromote: timed out waiting for event Page.loadEventFired: this build of rgl does not support snapshotsWriting '3D-SPIN004.png'
Warning: webshot2::webshot() failed; trying rgl.snapshot()Warning: this build of rgl does not support snapshots
会议信息:
R version 4.3.2 (2023-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.2.1
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: Asia/Tokyo
tzcode source: internal
attached base packages:
[1] stats4 stats graphics grDevices datasets utils methods base
other attached packages:
[1] plot3Drgl_1.0.4 plot3D_1.4 webshot2_0.1.1 magick_2.8.2 installr_0.23.4 scales_1.2.1
[7] rgl_1.2.8 plotly_4.10.3 SeuratDisk_0.0.0.9020 remotes_2.4.2 GenomicRanges_1.52.0 GenomeInfoDb_1.36.1
[13] IRanges_2.34.1 S4Vectors_0.38.1 BiocGenerics_0.46.0 Signac_1.12.0 Seurat_5.0.1 SeuratObject_5.0.1
[19] sp_2.0-0 lubridate_1.9.3 forcats_1.0.0 stringr_1.5.1 dplyr_1.1.2 purrr_1.0.2
[25] readr_2.1.4 tidyr_1.3.0 tibble_3.2.1 ggplot2_3.4.2 tidyverse_2.0.0 devtools_2.4.5
[31] usethis_2.2.2
我安装了谷歌浏览器。 rglWebGL 在 html 小部件中加载绘图,但所有保存的 png 或 gif 文件都是纯黑色/空的。 我不确定到底出了什么问题/缺少什么,我尝试过摆弄各种东西,但还没有任何改变。
感谢您的帮助
来自这些消息:
Error : Chromote: timed out waiting for event Page.loadEventFired
Warning: webshot2::webshot() failed; trying rgl.snapshot()Warning: this build of rgl does not support snapshots
似乎有两个问题。首先,它尝试使用
webshot2::webshot()
函数拍摄图像,但失败了。然后它又转而尝试通过从屏幕上的 XQuartz 复制来创建图像本身,这也失败了,因为 rgl
在没有 OpenGL 支持的情况下运行。
如果您可以在 OpenGL 支持下运行
rgl
,则可以修复第二个故障。如果您尚未安装 XQuartz,则可能需要安装它,然后您应该能够在单独的窗口中看到 plot3d()
结果弹出,并且 PNG 文件将是屏幕上内容的副本。
我不知道为什么
webshot2::webshot()
失败了。您可以尝试从 Github 安装开发版本;使用
remotes::install_github("rstudio/webshot2")
这样做。我不知道您使用的是哪个版本的
chromote
; 0.1.2 是当前版本,因此如果您有旧版本,更新到该版本可能会有所帮助。