X11 not available in R

Problem

I follow the code example and get an error message related to X11. To recreate my error, I ran x11 () and got the following:

> x11() Error in x11() : X11 is not available 

I was definitely plotting things in R that loaded the XQuartz program for display.

What i tried

  • I did ?x11() and saw that it was from the {grDevices} package. I downloaded this library, tried again, but got the same error. I read that X11 is related to XQuartz.
  • I reinstalled XQuartz 2.7.8. I have R 3.2.3 and I am running OSX El Capitan version 10.11.4 (15E65). I rebooted twice after reinstalling.
  • install.packages("Cairo")

    > x11( width=3, height=3) Error in x11(width = 3, height = 3) : X11 is not available

    > Sys.getenv("DISPLAY") [1] "/private/tmp/com.apple.launchd.F1bsaVCA43/org.macosforge.xquartz:0"

    > capabilities() jpeg png tiff tcltk X11 aqua http/ftp TRUE TRUE TRUE TRUE FALSE TRUE TRUE sockets libxml fifo cledit iconv NLS profmem TRUE TRUE TRUE TRUE TRUE TRUE TRUE cairo ICU long.double libcurl TRUE TRUE TRUE TRUE

- google research

On Google Googled, using my error message, and looked at the first two pages of my results, but did not find any solutions that worked. Based on my reading of the solutions, I presented my system information above, as it seems to be related somehow. Any ideas / solutions / new findings will be appreciated.

+6
source share
3 answers

The XQuartz package is the Mac X11, and your version is current. I am wondering if I need to reboot after installation, although I do not claim to know about it. (And this may not interfere with the repair permission.) On my Mac (running 3.3.0 on El Cap) I need to set the width and height (in inches, not pixels or dots);

  x11( width=3, height=3) 

What are you facing:

 Sys.getenv("DISPLAY") 

Maybe something like strings:

 "/private/tmp/com.apple.launchd.KImNTikz8K/org.macosforge.xquartz:0" 

Also do:

 capabilities() 
+3
source

I had the same problem and installing R separately from Rstudio fixed it. You can download it from here and check that x11 works with x11 ()

0
source

You must have a local X server, so get XQuartz because you are on MacOS.

If you were on Ubuntu, you could install an X11 virtual server for buffer servers, for example here :

 apt-get install xvfb xauth xfonts-base 

Now that you have X virtual framebuffer installed, you can start a new instance, for example here :

 Xvfb :0 -ac -screen 0 1960x2000x24 & 

Then, if your R is compiled with the with-x configuration parameter (enabled by default), you should have the X11 capability, and you just need to declare this in R:

 Sys.setenv("DISPLAY"=":0") 
0
source

All Articles