>>> import rpy2.robjects as robjects
>>> r = robjects.r
>>>
>>> x = [1,2,3]
>>> y = [2,4,2]
>>>
>>> r.png('plot.png',width=500,height=400)
<RObject - Python:0xb7d2d4ac / R:0x81f4458>
>>> r.plot(x,y)
<RObject - Python:0xb7d2d68c / R:0x81f4458>
>>> r['dev.off']()
<RVector - Python:0xb76487ec / R:0x857d8d8>
>>>

dev_off() turns off the device, in this case the device is writing to a file
so dev_off() flushes the buffer and closes the file.

L


2009/1/23 Michael Angerman <zrol...@gmail.com>

> Configuration :
>          Python 2.5.2
>          Windows Vista
>          R 2.7.0
>
> I have been using rpy-1.0.3-R-2.7.0-win32 fine for quite some time and am
> very happy with it.
>
> I am attempting to get a very simple program running on
> rpy2-2.0.1.win32-py2.5 without success.
>
> I am trying to save a simple plot
>
> --------------------------------------------------
>
> import rpy2.robjects as robjects
> r = robjects.r
>
> x = [1,2,3]
> y = [2,4,2]
>
> r.png('plot.png',width=500,height=400)
> r.plot(x,y)
>
> --------------------------------------------------
>
> The program executes fine without error,
> but the file is empty without data, file size = 0KB
>
> If I take out this line of code
>
> r.png('plot.png',width=500,height=400)
>
> the program works fine, and the window pops up with my graph.
>
> Also,
>
> r.dev_off()
>
> does not work in RPy2
>
> Do I still need to use this function ?
>
> It appears, I don't need it, because no window pops up with the above
> program,
> when I am attempting to save a graph to a png file.
>
> If I do need
>
> r.dev_off()
>
> What is the proper syntax to get this to work ?
>
> Thanks,
>
> Michael I Angerman
> Caltech
> Pasadena, California
>
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list
>
>
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to