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 at 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
I've seen this recently as well. I've done a bunch of updating recently (R to 4.1.0, chromote to the latest devel version, Chrome to a new release) and it's probably related to one of those, but I'm not sure which. What I've found is that the lockup occurs in chromote, and that's suspicious but not necessarily proof of the source of the problem. Do you have the same problems if you install the older file https://github.com/dmurdoch/drat/blob/gh-pages/src/contrib/chromote_0.0.0.9002.tar.gz ? Duncan Murdoch On 10/06/2021 4:42 a.m., David Waterman wrote:> 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 at 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 > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
On 10/06/2021 4:42 a.m., David Waterman wrote:> 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() > ```One suggestion I forgot: try snapshot3d("foo.png", webshot = FALSE). This should fall back to the internal snapshot code in rgl. You generally don't get as good quality of a result, but if you are not running on a headless system it will generally work. Duncan Murdoch
I believe I have found and fixed a bug in webshot2 that was causing these problems. My current recommendation for installing it is to use remotes::install_github("dmurdoch/webshot2 at fixlockup") For more details (and a bug fix for pkgdown, if you're trying to put dynamic graphics on a pkgdown site) see https://github.com/dmurdoch/rgl#note-about-devel-versions Duncan Murdoch