[IPython-dev] R magic extension and default R graphic drivers

Massimo Di Stefano massimodisasha at gmail.com
Fri Aug 31 19:45:28 EDT 2012


Hi All,



i'm trying to run some R code from inside a notebook running on a server that doesn't have X running
the missing X ... generate an error with the default png driver.


if i try to run some R code that involve the graphic drivers
i got an error :

RRuntimeError: Error in X11(paste("png::", filename, sep = ""), g$width, g$height, pointsize,  : 
  unable to start device PNG



full error log is here : 

http://epifanio.whoi.edu/data/img/rext_log.txt



i guess, the reason of this error is because the server doesn't allow X fwd 
and seems doesn't have X running at all.

i can reproduce this error (or similar) also from the R console itself :

> png(file="myplot.png", bg="transparent")
Error in X11(paste("png::", filename, sep = ""), g$width, g$height, pointsize,  : 
  unable to start device PNG
In addition: Warning message:
In png(file = "myplot.png", bg = "transparent") :
  unable to open connection to X11 display ''
> 

it can be avoided if i set the driver to "cairo" :

> options(bitmapType="cairo") 
> png(file="myplot.png", bg="transparent")
> 

The solution in R was to write a file  ".Rprofile" in my home directory, so now i don't need anymore to use options(bitmapType="cairo")  in the R prompt.

i was hoping that this option was able to fix also the error inside the IPython notebook .. but instead it persist.



from the error log i can see that in the file :

IPython/extensions/rmagic.py  

line 515

we have :

self.r('png("%s/Rplots%%03d.png",%s)' % (tmpd, png_args))

perhaps it is possible to set the driver to be used directly in rmagic code,
have you any clue on how can i fix this problem?

thanks a lot!

Massimo.

[1]



 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20120831/0461d32d/attachment.html>


More information about the IPython-dev mailing list