Ishwor wrote:
> Tom
> Hi.
>> i want to use R with Python and Cairo. I have the following problem:
>>
>> ####################
>> # Python
>> ####################
>>>>> from rpy2 import robjects
>>>>> robjects.r('library(Cairo)')
>> Error in library(Cairo) : es gibt kein Paket 'Cairo'
>> Traceback (most recent call last):
>>  File "<stdin>", line 1, in <module>
>>  File "/usr/lib/python2.6/dist-packages/rpy2/robjects/__init__.py",
>> line 535, in __call__
>>    res = self.eval(p)
>>  File "/usr/lib/python2.6/dist-packages/rpy2/robjects/__init__.py",
>> line 422, in __call__
>>    res = super(RFunction, self).__call__(*new_args, **new_kwargs)
>> rinterface.RRuntimeError: Error in library(Cairo) : es gibt kein Paket
>> 'Cairo'
>>
>> ####################
>> # R
>> ####################
>>> library(Cairo)
>>>
>>
>>
>> Can anybody help with this problem? My future plan is to use Python+R
>> +Django to produce nice graphs with R and display the graphs within a
>> website.

I think that the issue is the one reported by the RRuntimeError 
exception (albeit in German): there is no such package known to the R 
install used with rpy2. Error message can sometimes be informative.

http://rpy.sourceforge.net/rpy2/doc-dev/html/robjects.html#installing-removing-r-packages

> A question:
> Why are you loading Cairo from within R (Obviously assuming R has
> interface to Cairo ;-)

R has a package called Cairo.
http://cran.r-project.org/web/packages/Cairo/index.html

> http://cairographics.org/pycairo/ is python binding to Cairo graphics
> from _within_ Python (I'd use that if I had a choice)
> 
> I'd would try n use Rpy2/Rpy only for R-related functions/algorithms
> and try to separate them. Once the calculations are done by
> Rpy/Rpy2/R, then use PyCairo to display the results _in_ Python.

R has much to offer for making graphics.
The following plot is made with two lines of Python code with rpy2:
http://rpy.sourceforge.net/rpy2/doc-dev/html/_images/graphics_ggplot2_smoothbycylwithcolours.png
I am not certain that using pycairo can give similar results without 
writing much more code.

> Regarding Django interfacing another way is to use Protovis
> (http://vis.stanford.edu/protovis)  to display the calculations from
> Rpy2 (at the presentation/HTML layer) using Django templates.

This is looking like a very interesting project... thanks for sharing 
the link.


L.

> HTH.


------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to