[R] Plotting to stdout

Romain Francois romain.francois at dbmail.com
Fri Aug 28 13:25:27 CEST 2009


On 08/28/2009 01:16 PM, Gábor Csárdi wrote:
>
> On Fri, Aug 28, 2009 at 1:06 PM, Oliver Bandel<oliver at first.in-berlin.de>  wrote:
> [...]
>> The goal was to produce a picture in a web-environment.
>>
>> At the moment rpy2 will be used.... maybe there are way to achieve something
>> like that in this way, but I'm also new to rpy2.
>>
>> When the graphic could be written to stdout, the calling environment could reead
>> it from the forked process.
>>
>> But maybe rpy2 works different.
>>
>> Any ideas on that on-the-fly creation of pictures?
>> If there would be no temporary files this would be fine.
>> That's the reason why I looked for stdout as output channel.
>
> Oliver,
>
> I have a similar problem and had a similar question on the list about
> a week ago.... all I could find out that some devices of the Cairo
> package are supposed to support plotting to R connections (including
> stdout), but it does not work in practice:
>
>> library(Cairo)
>> tc<- textConnection("foo", "w")
>> CairoPNG(file=tc)
> Error in Cairo(width, height, type = "png", file = filename, pointsize
> = pointsize,  :
>   file must be a filename. to support writing to a connection,
> recompile R and Cairo with the R Connection Patch.
>
> Information on the "R connection Patch" is welcome. Recompiling R and
> Cairo is not a problem for me, I am putting together a special
> environment anyway.
>
> Best,
> Gabor
>
> [...]
>

This is a patch that was offered by Jeff Horner some time ago ;

http://tolstoy.newcastle.edu.au/R/e2/devel/06/10/0565.html
http://wiki.r-project.org/rwiki/doku.php?id=developers:r_connections_api

The patch allows packages to exploit the connection api from the C 
level, a privilege that still remains internal to R.

Romain

-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/xkMc : Combine R CMD build and junit
|- http://tr.im/w33B : Completion for java objects
`- http://tr.im/vzip : Code Snippet : List of CRAN packages




More information about the R-help mailing list