[IPython-User] RMagic causing X11 png call?

Massimo Di Stefano massimodisasha@gmail....
Sun Oct 7 11:27:56 CDT 2012


Hi Spencer,

i don't know if you fixed this problem or if my hints can help ..

i'm tring right now to run the Rmagic extension on a notebook running on webfaction
the machine doesn't have "x" and i don't have sudo.

so i built R from source adding the support for cairo, 
then in the Rmagic src file i added a line to force R to use the cairo driver as default driver to produce the png :

in :
 
python2.7/site-packages/IPython/extensions/rmagic.py

at line '515', i added : 

self.r('options(bitmapType="cairo")')

just before the line :

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

Hope that helps.

Massimo.



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

> What is strange is that the command I am running:
> 
> %R b <- c(1,2,3,4)
> 
> Should not produce any graphical output. I cannot run any R code with RMagic.
> 
> Spencer
> 
> 
> 
> On 9/6/2012 11:16 AM, Massimo Di Stefano wrote:
>> 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
>> 
> 
> _______________________________________________
> 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/20121007/1c5d80ac/attachment-0001.html 


More information about the IPython-User mailing list