[R] Plotting to stdout

Jeffrey Horner jeff.horner at vanderbilt.edu
Fri Aug 28 16:21:47 CEST 2009

Gábor Csárdi wrote:
> On Fri, Aug 28, 2009 at 1:33 PM, Gabor
> Grothendieck<ggrothendieck at gmail.com> wrote:
> [...]
>> I could have used this functionality in a previous project as well; however,
>> for Oliver's application just pass the filename to the python program use that
>> in the <img src=...> tag (or have the python program pass the filename to
>> the R program).
>> If there is some aspect of this problem that has not been explained that
>> truly does make passing the graphic file contents to the python
>> program desirable
>> then have R write out the graphic file and then have R read it back in.
> Unfortunately, this is not always a good solution. For example, I am
> running Rserve with connections from untrusted users. The Rserve
> process is not allowed to write to the disk at all, but then there is
> no easy way to create plots.
> The patch Romain mentioned above looks like a good solution.
The R connections patch worked well on Unix at the time, but it was 
never tested on the other R supported platforms. I believe this was R 
core's complaint about not considering it as a patch.

There's yet another option, although someone would need knowledge of 
converting raw image data to PNG (or other) format in memory: the Cairo 
package allows access to the raw image data from R itself, although it's 
undocumented and experimental. The functions are defined in R/imgtools.R 
within the Cairo source package.


More information about the R-help mailing list