[R] rgl.postscript hang
J C Nash
pro|jcn@@h @end|ng |rom gm@||@com
Sun Mar 10 19:57:24 CET 2019
I've found some other reports that resemble this, but none seem to have a clear
indication of the source of the hangup. This post raises a non-critical issue, but
it would be nice to understand the problem and possibly fix it, or else have an
error message generated. As Duncan has posted in one of the items, rgl.snapshot is
recommended, and it worked for me, but I originally wanted a pdf so tried rgl.postscript
before I saw his comment that the latter may give problems. Indeed, users may not
realize that the message in the documentation
"This function is a wrapper for the GL2PS library by Christophe Geuzaine,
and has the same limitations as that library: not all OpenGL features are
supported, and some are only supported in some formats. See the reference for
full details."
can imply a "hang" rather than a failure that leaves R (or RStudio) running. Or indeed
crashes them, which it may do in other systems. I used the Linux "kill" command after
using "ps ax" to find which processes were running R or RStudio.
The relevant previous posts are
https://stackoverflow.com/questions/23242846/exporting-rgl-snapshot-and-rgl-postscript-fails
https://support.rstudio.com/hc/en-us/community/posts/200669327-rgl-postscript-hangs
http://r.789695.n4.nabble.com/rgl-postscript-failure-when-saving-a-scene-td4177241.html
My code that hangs is as follows with the rgl.snapshot line commented and the rgl.postscript
one uncommented. The script displays an image box with the correct graph, and seems to output
a partial preamble to the eps file before hanging. This occurs in either R or RStudio.
Unless someone has a true solution, I suggest offline communications until we have an
understanding of the problem. I'm posting mainly to try to put a box around the issue to
help others avoid it.
Best,
JN
---------------
# candlestick function
# J C Nash 2011-2-3
cstick.f<-function(x,alpha=100){
x<-as.vector(x)
r2<-crossprod(x)
f<-as.double(r2+alpha/r2)
return(f)
}
x <- (-100:100)/5
y <- x
library(rgl)
z <- matrix(NA, length(x), length(y))
for (i in seq_along(x)) {
for (j in seq_along(y)) {
z[i,j] <- cstick.f(c(x[i],y[j]))
if (is.infinite(z[i,j])) {z[i,j] <- 1000}
}
}
persp3d(x, y, z, col='red')
par3d( windowRect=c( 0,0,500,500 ) )
# rgl.postscript("candlestick3d.eps","eps")
rgl.snapshot("candlestick3d.png","png")
rgl.pop()
----------------
System had following setup
sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 19.1
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so
locale:
[1] LC_CTYPE=en_CA.UTF-8 LC_NUMERIC=C LC_TIME=en_CA.UTF-8 LC_COLLATE=en_CA.UTF-8
LC_MONETARY=en_CA.UTF-8
[6] LC_MESSAGES=en_CA.UTF-8 LC_PAPER=en_CA.UTF-8 LC_NAME=C LC_ADDRESS=C
LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rgl_0.99.16
loaded via a namespace (and not attached):
[1] Rcpp_1.0.0 digest_0.6.18 later_0.8.0 mime_0.6 R6_2.4.0
jsonlite_1.6
[7] xtable_1.8-3 magrittr_1.5 evaluate_0.13 miniUI_0.1.1.1 promises_1.0.1
rmarkdown_1.11
[13] webshot_0.5.1 tools_3.5.2 manipulateWidget_0.10.0 htmlwidgets_1.3 crosstalk_1.0.0
shiny_1.2.0
[19] httpuv_1.4.5.1 xfun_0.5 yaml_2.2.0 compiler_3.5.2 htmltools_0.3.6
knitr_1.21
>
I got the same behaviour on another machine running Linux Mint 18.3.
More information about the R-help
mailing list