0

I'm sorry if this isn't the place for posting this kind of questions, but i've tried and googled everything and still i'm not able to find an answer.

I'm trying to plot ANYTHING in rgl from r, but when i do it, being the code anything, the 3d plot window appears just for one second and closes.

Im using OSX (El Capitan) and the last version of X11 (tried with stable and dev both).

I'm testing basic codes from everywhere, even the examples and the demo of the rgl package, but it's the same with all.

One example:

library(rgl)
open3d()
x <- sort(rnorm(1000))
y <- rnorm(1000)
z <- rnorm(1000) + atan2(x,y)
plot3d(x, y, z, col=rainbow(1000))

Any idea/advice?

As requested, the output added from devtools::session_info():

Session info -------------------------------------------------------------------
 setting  value                       
 version  R version 3.2.2 (2015-08-14)
 system   x86_64, darwin15.0.0        
 ui       unknown                     
 language (EN)                        
 collate  en_US                       
 tz       America/Santiago            

Packages -----------------------------------------------------------------------
 package   * version date       source        
 curl        0.9.3   2015-08-25 CRAN (R 3.2.2)
 devtools  * 1.8.0   2015-05-09 CRAN (R 3.2.2)
 digest      0.6.8   2014-12-31 CRAN (R 3.2.2)
 git2r       0.11.0  2015-08-12 CRAN (R 3.2.2)
 memoise     0.2.1   2014-04-22 CRAN (R 3.2.2)
 Rcpp        0.12.1  2015-09-10 CRAN (R 3.2.2)
 rversions   1.0.2   2015-07-13 CRAN (R 3.2.2)
 xml2        0.1.2   2015-09-01 CRAN (R 3.2.2)
Ghost
  • 1,426
  • 5
  • 19
  • 38
  • Using the code from Rstudio works fine, but when calling it from R prompt or any ide fails, just pops up the rgl window for a second and closes (can you plz try that code from the R prompt?) I added the output from the devinfo in the main post! – Ghost Sep 12 '15 at 17:08
  • Sorry, i was in a session where i haven't imported rgl library, my mistake, rgl version: rgl * 0.95.1247 2015-05-01 CRAN (R 3.2.2) But the second part is important, u're right; when i call the code from the prompt or an IDE, the UI is 'unknown', when i call it from Rstudio, it is "Rstudio, ver xxxxx.." – Ghost Sep 12 '15 at 17:30
  • Ok, i made a clean reinstall of R and Xquartz and now i get 'X11' in the ui tag, but still got the same problem.. – Ghost Sep 12 '15 at 17:57
  • El Capitan is unreleased, so this sounds like something you should report to Apple. – user2554330 Sep 13 '15 at 20:12
  • I don't think this is a bug in the OS, but in the R configuration. Have you read any of the posts? Rgl works perfect when calling it from Rstudio, but not when calling it from the prompt, so i believe the bug lies specifically in some "setting" or similar that Rstudio has by default on and the R prompt not. – Ghost Sep 13 '15 at 20:21
  • RStudio runs the X11 version of rgl, R.app will run the agl version. So deleting that, i.e. the file given by system.file("libs/aglrgl.so",package="rgl") might help. If that file is not found, rgl will use X11 in both cases. – user2554330 Sep 14 '15 at 01:41
  • Same behaviour, tried that and no difference – Ghost Sep 14 '15 at 02:30
  • Ok, after a while i realized what the problem is.. when i call the script via `Rscript file` it closes because after the script ends the process terminates. Rstudio calls the script from inside the R console, so it uses `source`, then the R console is not killed after the script ends and the boxplot stays on screen. Now i need a way to execute the script from a terminal without closing the R console after the script is finished (my problem is the same as this one http://stackoverflow.com/questions/24220676/r-script-using-x11-window-only-opens-for-a-second) – Ghost Sep 15 '15 at 14:11
  • You should add that to the question and you can keep the Rscript "open" by adding `readLines(con="stdin", 1)` to the end of it (it'll wait for you to press enter/return) – hrbrmstr Sep 15 '15 at 20:10

0 Answers0