[R] snapshot3d hangs during rmarkdown::render
David Waterman
dgw@term@n @end|ng |rom gm@||@com
Thu Jun 10 10:42:54 CEST 2021
Hi all,
I tried subscribing to the list yesterday, but this does not appear to
have been successful. Therefore I am hoping this message meets
volunteer moderator approval.
I have problems using snapshot3d from rgl while trying to render an R
Markdown page. I want to do this to capture static snapshots of an
interactive widget on the page. I had this working with an earlier
version of R (sorry, forgot which), but this now hangs indefinitely at
the snapshot3d call.
Should I expect this to work? I can successfully create a snapshot
from an interactive R session with either webshot=TRUE or FALSE, just
not from within my R Markdown build.
I have created a simple reproducer, which I attempt to build using:
library(rmarkdown)
rmarkdown::render("reproducer.Rmd")
where the contents of reproducer.Rmd are:
$ cat reproducer.Rmd
---
title: "rgl test"
output:
html_document:
toc: true
toc_float:
toc_collapsed: true
---
```{r, setup, echo=FALSE}
library(rgl)
library(knitr)
knitr::knit_hooks$set(webgl = hook_webgl)
```
### Insert rgl figure
Test
```{r, webgl=TRUE, echo=FALSE}
with(iris, plot3d(Sepal.Length, Sepal.Width, Petal.Length,
type="s", col=as.numeric(Species)))
snapshot3d("foo.png")
rglwidget()
rgl.close()
```
### END
Information about my R session:
> sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.5 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1
locale:
[1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8
[5] LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
[7] LC_PAPER=en_GB.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] webshot2_0.0.0.9000 chromote_0.0.0.9003 rmarkdown_2.8
[4] rgl_0.106.8 knitr_1.33
loaded via a namespace (and not attached):
[1] Rcpp_1.0.6 digest_0.6.27 later_1.2.0
[4] mime_0.10 R6_2.5.0 lifecycle_1.0.0
[7] xtable_1.8-4 jsonlite_1.7.2 magrittr_2.0.1
[10] evaluate_0.14 rlang_0.4.11 miniUI_0.1.1.1
[13] promises_1.2.0.1 ellipsis_0.3.2 tools_4.1.0
[16] manipulateWidget_0.11.0 htmlwidgets_1.5.3 crosstalk_1.1.1
[19] shiny_1.6.0 fastmap_1.1.0 httpuv_1.6.1
[22] xfun_0.23 compiler_4.1.0 htmltools_0.5.1.1
I got R from an Ubuntu package:
$ dpkg -s r-base-core|head
Package: r-base-core
Status: install ok installed
Priority: optional
Section: gnu-r
Installed-Size: 40697
Maintainer: Dirk Eddelbuettel <edd using debian.org>
Architecture: amd64
Source: r-base
Version: 4.1.0-1.1804.0
Replaces: r-base (<= 1.4.1-1), r-base-latex (<= 2.9.2-4),
r-cran-rcompgen (<= 0.1-17-1), r-gnome (<= 2.3.1), r-recommended (<<
1.9.0)
which came from here:
$ grep "r-project" /etc/apt/sources.list
deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/
# deb-src https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/
Many thanks,
David Waterman
STFC Computational Scientist
More information about the R-help
mailing list