On 2/10/10 2:08 PM, Willem Ligtenberg wrote:
> Hi,
> I am able to create a 3d graph with R using rgl. In R they work fine.
> Then I want to use the same stuff in my python script, and it seems to
> work, except that the graphs are not interactive.
> I use r['readline']("Press<Enter>  to exit: ") to make the script wait
> so that the graphs are not destroyed immediately.
> It happens with the following code:
>
> import rpy2.robjects as robjects
> r = robjects.r
> x = [1,2]
> y = [1,2]
> z = [1,2,3,4]
> r['library']('rgl')
> x = robjects.FloatVector(x)
> y = robjects.FloatVector(y)
> z = robjects.FloatVector(z)
> r['persp3d'](x, y, z)
> r['readline']("Press<Enter>  to exit: ")

I am not familiar enough with the internals of the rgl device... but 
there is a chance that what you need is this instead.
http://rpy.sourceforge.net/rpy2/doc-2.1/html/rinterface.html#graphical-devices

(lower the sleep time and / or the timer if the response to 
interactivity feel slow)


> I am using the latest R from (R version 2.10.1 (2009-12-14))
> deb http://cran-mirror.cs.uu.nl/bin/linux/ubuntu karmic/
>
> Ubuntu Karmic
> Python 2.6.4 (r264:75706, Dec  7 2009, 18:45:15)
>
> rpy2:
> 2.0.4a-1 
> (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_karmic_universe_binary-i386_Packages)


In the 2.0.x series, the current release is 2.0.8. Update if you have a 
chance... or live on the edge and go for the 2.1.0alpha3.

HTH,


L.



> Thanks in advance,
>
> Willem
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to