Hello Laurent,

I've attached a minimal example. Removing the comment at line 69, which reads:
pp=pp+ggplot2.geom_line(datafline,ggplot2.aes_string(x='z',y='dens'))

results in the following output from iPython:
----------------x----------------
Error: ggplot2 doesn't know how to deal with data of class uneval
---------------------------------------------------------------------------
RRuntimeError                             Traceback (most recent call last)

/xxx/plot_reject_example.py in <module>()
     73
     74 if __name__ == '__main__':
---> 75     pp=main()
     76     pp.plot()
     77

/xxx/plot_reject_example.py in main()
     67
     68     ## Use one of the following lines to draw the line graph.
Either one currently results in failure

---> 69     
pp=pp+ggplot2.geom_line(datafline,ggplot2.aes_string(x='z',y='dens'))
     70     
#pp=pp+ggplot2.geom_line(data=datafline,ggplot2.aes_string(x='z',y='dens'))

     71

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/rpy2-2dev_20091103-py2.6-macosx-10.6-i386.egg/rpy2/robjects/lib/ggplot2.pyc
in new(*args, **kwargs)
     93        args_list = list(args)
     94        cls = args_list.pop(0)
---> 95        res = cls(cls._constructor(*args_list, **kwargs))
     96        return res
     97

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/rpy2-2dev_20091103-py2.6-macosx-10.6-i386.egg/rpy2/robjects/functions.pyc
in __call__(self, *args, **kwargs)
     75                 v = kwargs.pop(k)
     76                 kwargs[r_k] = v
---> 77         return super(SignatureTranslatedFunction,
self).__call__(*args, **kwargs)
     78
     79

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/rpy2-2dev_20091103-py2.6-macosx-10.6-i386.egg/rpy2/robjects/functions.pyc
in __call__(self, *args, **kwargs)
     33         for k, v in kwargs.iteritems():
     34             new_kwargs[k] = conversion.py2ri(v)
---> 35         res = super(Function, self).__call__(*new_args, **new_kwargs)
     36         res = conversion.ri2py(res)
     37         return res

RRuntimeError: Error: ggplot2 doesn't know how to deal with data of class uneval

WARNING: Failure executing file: <plot_reject_example.py>
----------------x----------------

Removing the comment at line 70, which reads:
pp=pp+ggplot2.geom_line(data=datafline,ggplot2.aes_string(x='z',y='dens'))

results in the following output from iPython:
----------------x----------------
------------------------------------------------------------
   File "plot_reject_example.py", line 70
     pp=pp+ggplot2.geom_line(data=datafline,ggplot2.aes_string(x='z',y='dens'))
SyntaxError: non-keyword arg after keyword arg

WARNING: Failure executing file: <plot_reject_example.py>
----------------x----------------

What do you think? What is type uneval? Thank you.

Faisal

On Sat, Nov 28, 2009 at 4:05 AM, Laurent Gautier <lgaut...@gmail.com> wrote:
> Faisal,
>
> At first sight the difference between your R code and your rpy2 code for
> geom_line is that you pass the data.frame zfunc with a name
> ( data = zfunc ) with R, and without with rpy2.
>
> Without the complete Python traceback or a standalone example (off-list, if
> you are more comfortable to do so because of the data), it might be hard to
> tell more.
>
>
> L.
>
>
>
>
> Faisal Moledina wrote:
>>
>> Hello everyone,
>>
>> I'm trying to port the following R code to rpy2:
>>
>>
>> plots<-ggplot(pz_r,aes(x=z))+geom_histogram(aes(y=..density..),binwidth=bw)+geom_line(data=zfunc,aes(x=z,y=dens))
>>
>> where pz_r is a data frame of observations of the random variable z,
>> and zfunc is a data frame with the probability density function (z and
>> dens). Currently, I've been able to port the histogram more or less
>> using:
>>
>>
>> pp=ggplot2.ggplot(pz_r)+ggplot2.aes_string(x='z')+ggplot2.geom_histogram(ggplot2.aes_string(y='..density..'),binwidth=bw)
>>
>> However, I'm not sure how to get geom_line() to use the zfunc data frame:
>>
>> pp=pp+ggplot2.geom_line(zfunc,ggplot2.aes_string(x='z',y='dens'))
>>
>> I get
>> Error: ggplot2 doesn't know how to deal with data of class uneval
>>
>> I'm using rpy2 2.1.0dev. Help with this would be much appreciated. Thank
>> you.
>>
>> Faisal Moledina
>>
>>
>> ------------------------------------------------------------------------------
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>> 30-Day trial. Simplify your report design, integration and deployment - and
>> focus on what you do best, core application coding. Discover what's new with
>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>> _______________________________________________
>> rpy-list mailing list
>> rpy-list@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/rpy-list
>
>

Attachment: plot_reject_example.py
Description: Binary data

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to