On 12/10/09 6:07 PM, Faisal Moledina wrote:
> On Thu, Dec 10, 2009 at 2:13 AM, Laurent Gautier<lgaut...@gmail.com>  wrote:
>>
>> Can you report in the bitbucket issue tracker what is that
>> is missing from rpy2.robjects.lib.ggplot2 so it can be added ?
>>
>> (note: the mapping is hopefully moving towards a more dynamic generation,
>> although that's probably for release 2.2)
>
> I'll report that at least theme_set etc is missing from the static lib.

I just added them, and committed the changes.

>>> In R, I would just type 'pp' at
>>> the prompt to show the plot. Is it that simple in rpy2?
>>
>> Just calling a symbol in the R console will trigger it's console display
>> (that is call the print method). This is basically what the method plot is
>> doing.
>
> Maybe I'm missing something basic. I've read and reread the rpy-list
> thread at 
> http://www.mail-archive.com/rpy-list@lists.sourceforge.net/msg01665.html
> entitled "how to pass a python object to R".
>
>      import rpy2.robjects as ro
>      gg=importr("ggplot2")
>      ... # generating data
>      #plotting
>      pp=gg.ggplot(datafhist)+gg.aes(x='z',y='..density..')
>      pp+=gg.geom_histogram(binwidth=bw)
>      pp+=gg.geom_line(gg.aes(x='z',y='dens'),data=datafline)
>      pp+=gg.scale_x_continuous("z position")
>      pp+=gg.theme_set(gg.theme_bw())
>
>>>> ro.globalenv['pR1']=pp
>>>> ro.r['pR1']
> <Vector - Python:0x101c47518 / R:0x101d8ff80>
>>>> ro.globalenv['pR2']=ro.conversion.py2ri(pp)
>>>> ro.r['pR2']
> <Vector - Python:0x101c47c68 / R:0x101d81d80>
>>>> print(ro.r['pR2'])
> $data
> ...contains all the ggplot2 items
>
> I'm not sure what's going on here. Is the object supposed to be a
> Vector? For the static lib, it ended up being a GGPlot.

Complex situation on the R side (as there several ways to do OOP in R - 
a partial explanation is at
 
http://rpy.sourceforge.net/rpy2/doc-dev/html/robjects.html#working-with-r-s-oops
).
Check also the line 23 in ggplot2.py
 
http://bitbucket.org/lgautier/rpy2/src/tip/rpy/robjects/lib/ggplot2.py#cl-23

(or just use the static lib, since the issue you had is now fixed)



L.

> Faisal


------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to