简体   繁体   中英

R rgl package error while loading the library

My system environment:

Mac OS 10.10.2

X11 (XQuartz 2.7.5)

R 3.1.2

When I load and use 'rgl' package, I get following error message.

> library("rgl",lib.loc="/Library/Frameworks/R.framework/Versions/3.1/Resources/library")
Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: In fun(libname, pkgname) : error in rgl_init
> plot3d(x,y,z)
Error in rgl.open(useNULL) : rgl.open failed

What's the problem?

I was already using rstudio when I got this warning. This seemed to work for me as suggested on https://cran.r-project.org/web/packages/shinyRGL/README.html .

  1. I ran this on R console options(rgl.useNULL=TRUE)
  2. I restarted the session using .rs.restartR()
  3. Loaded the library again: library("plot3Drgl")

HTH ...

rgl appears to be working with RStudio. I'd make sure you have XQuartz installed on your system https://xquartz.macosforge.org/landing/ as X11 is no longer included with OS X by default. Let us know if it's still not working for you.

Start XQuartz before loading the rgl package. rgl displays images in an XQuartz window, but it does not seem to be able to open a RGL device window from within R when XQuartz is not already running. This works with Mac OS 10.11.3, XQuartz 2.7.8, R 3.2.3.

Detection of XQuartz on Mac OS is a little flaky. The latest rgl (version 0.95.1456) on R-forge might do better.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM