On Nov 15, 2007 2:41 PM, Michael Lawrence <[EMAIL PROTECTED]> wrote:
> This is possible using the cairoDevice package and RGtk2.
>
> Turning an R graphic into a raw vector of bytes:
>
> library(cairoDevice)
> library(RGtk2)
>
> # create a pixmap and tell cairoDevice to draw to it
>
> pixmap <- gdkPixmapNew(w=500, h=500, depth=24)
> asCairoDevice(pixmap)
>
> # make a dummy plot
>
>  plot(1:10)
>
> # convert the pixmap to a pixbuf
>
> plot_pixbuf <- gdkPixbufGetFromDrawable
> (NULL, pixmap, pixmap$getColormap(), 0, 0, 0, 0, 500, 500)
>
> # save the pixbuf to a raw vector
>
> buffer <- gdkPixbufSaveToBufferv(plot_pixbuf, "jpeg", character(0),
> character(0))$buffer
>
> ###
>
> Then you can send buffer to your database, or whatever. Replacing "jpeg"
> with "png" will probably produce png output.
>
> Michael
>

Many thanks to all respondents. I'll play with these.

-Josh

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to