[IPython-User] RMagic causing X11 png call?

Massimo Di Stefano massimodisasha@gmail....
Thu Sep 6 10:16:47 CDT 2012


Hi Spencer,

i noticed the list with the same problem.
on this list, see the topic :

 R magic extension and default R graphic drivers

http://old.nabble.com/R-magic-extension-and-default-R-graphic-drivers-td34376003.html

my understanding is :

as default R use the  png-x11 driver,  in order to produce a png (used by the notebook)
we should specify R to use an other Driver ..  "cairo" can be a good option.
in R you can specify the driver to be used (instead of the default X11 png) with a syntax like :

> png(file="myplot.png", bg="transparent", type="cairo'")

or typing the instruction :

options(bitmapType="cairo") 

and then you can avoid to specify the "type=cairo"  in the plot instruction.

an other way is  to add inside a .Rprofile file in your home. 
a line like :

options(bitmapType="cairo") 



Unfortunately the Rmagic extension seems to don't recognize the .Rprofile settings
or more probable, in the RMagic src code :

IPython/extensions/rmagic.pyc in R(self, line, cell, local_ns)
    513 
    514         tmpd = tempfile.mkdtemp()
--> 515         self.r('png("%s/Rplots%%03d.png",%s)' % (tmpd, png_args))
    516 
    517         text_output = ''
we should be able to pass the  "type-cairo" as argument to the png() function.


i'm trying to modify the src code but without success

Massimo.





Il giorno Sep 6, 2012, alle ore 9:11 AM, Spencer Ogden ha scritto:

> I am running iPython remotely and I don't have X11 setup. For some 
> reason, RMagic, even with simple code, is trying to present a PNG 
> through X11, and failing since there is no X11.
> 
> I tried %gui to turn of any GUI integration. When I enter "%R b <- 
> c(1,2,3,4)" I get a RRuntimeError:
> 
> RRuntimeError: Error in png("/tmp/tmpwGLwWm/Rplots%03d.png", ) : X11 is 
> not available
> 
> Why would RMagic be trying to produce a png?
> 
> I tried this in the web notebook as well and got the same error.
> 
> Thanks,
> 
> Spencer
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20120906/43086c40/attachment-0001.html 


More information about the IPython-User mailing list