[R] Plotting to a connection

Gábor Csárdi csardi.gabor at gmail.com
Tue Aug 25 20:08:54 CEST 2009


Dear All,

is there a way to plot to a connection? I mean, I would like to do
something like

> tc <- textConnection("foo", "w")
> png(tc)
> plot(...)
> close(tc)

According to the documentation of the Cairo package, this should work
with CairoPNG() (among others), but all I get is

> 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.

Anybody knows what is the "R Connection Patch"?

Btw. is there any particular reason that the png(), jpeg(), etc.
devices do not work with connections?

Thanks,
Gabor

-- 
Gabor Csardi <Gabor.Csardi at unil.ch>     UNIL DGM




More information about the R-help mailing list