Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I just set up a fedora distribution on my computer and am slowly trying to learn how to work from the command line. I was testing R which went fine, except for some reason when I tried again I suddenly seem to be unable to draw plots. I get the error:

> x = 1:5
> y = x^2
> plot(x,y)
No protocol specified
Error in X11(d$display, d$width, d$height, d$pointsize, d$gamma, d$colortype,  : 
  unable to start device X11cairo
In addition: Warning message:
In function (display = "", width, height, pointsize, gamma, bg,  :
  unable to open connection to X11 display ''

and when I check the capabilities I see that X11 is FALSE:

> capabilities()
No protocol specified
    jpeg      png     tiff    tcltk      X11     aqua http/ftp  sockets 
    TRUE     TRUE     TRUE     TRUE    FALSE    FALSE     TRUE     TRUE 
  libxml     fifo   cledit    iconv      NLS  profmem    cairo 
    TRUE     TRUE     TRUE     TRUE     TRUE    FALSE     TRUE 

Although I know nothing about whether those are connected or not it seems X11 should be on?

Everywhere I searched for this people seemed to have this problem when working over an ssh connection (I haven't yet taken a look at what that is exactly :$).

I hope someone who knows what this problem is about could be so nice to explain the problem to me and suggest a solution.

Thanks in advance from a n00b

share|improve this question
    
Before starting R can you post output of echo $DISPLAY –  Karlson Feb 9 '12 at 15:48
    
This command yields ´:0´ –  Jóhann Feb 9 '12 at 16:29
    
How about from R: Sys.getenv("DISPLAY") –  Karlson Feb 9 '12 at 16:39
    
hmm, this only gives me bash: syntax error near unexpected token "DISPLAY"'` –  Jóhann Feb 9 '12 at 16:44
    
Do this: Sys.getenv(DISPLAY) or this: Sys.getenv('DISPLAY') or Sys.getenv(c("DISPLAY")) –  Karlson Feb 9 '12 at 16:51

1 Answer 1

up vote 3 down vote accepted

There are many threads elsewhere related to Cairo package.

One of them mentions the change in X11 type but most of them state that R doesn't know what the display is and suggest doing:

Sys.putenv("DISPLAY"=":0.0")
share|improve this answer
1  
Unfortunately neither this solution, or the one mentioned in the other thread seem to fix this. :/ My package also insists on me using Sys.setenv instead of putenv.. don't know if hte new command is different? –  Jóhann Feb 9 '12 at 17:07
    
Sys.putenv is deprecated in favor of Sys.setenv –  Karlson Feb 9 '12 at 17:18
1  
This worked the next time I tried to use this :). Must have been something strange with the last session –  Jóhann Feb 14 '12 at 18:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.