This works on Windows: dev.control(displaylist="enable") # enable display list plot(1:10) myplot <- recordPlot() # load displaylist into variable
You can now store myplot and later fetch it and play it back via myplot # or if not from the console print(myplot) On Nov 15, 2007 4:07 PM, Josh Tolley <[EMAIL PROTECTED]> wrote: > I'm using R embedded in PostgreSQL (via PL/R), and would like to use > it to create images. It works fine, except that I have to create every > image in a file (owned by and only readable by the PostgreSQL server), > and then use PostgreSQL to read from that file and return it to the > client. It would be much nicer if I could plot images into an R > variable (for instance, a matrix), and return that variable through > the PostgreSQL client. Leaving aside the details of returning the data > to PostgreSQL (which I realize are beyond the scope of this list), I > envision R code along the lines of the following: > > # Create a png device, a handle to which is stored in myDevice > > myDevice <- png.variable(height = 1280, width = 1024, bg = "white") > # Plot some data into the current device > > plot(myX, myY, col="red") > # Finalize > > dev.off() > # Print out the contents of myDevice > > myDevice > > ...and the data would print out just like any other matrix or class or > whatever type myDevice actually is. > > So my question is does such a thing already exist? I know about > piximage, but apparently I have to load image data from somewhere for > it to work; I can't use plot(), etc. to create the piximage data. GDD > would be a nice way to do it, because GD libraries are widely > available for use with other languages I might use with PostgreSQL and > PL/R (for instance, Perl would talk to PostgreSQL, call a PL/R > function to use R to return an image, which Perl would then process > further), but GDD requires temporary files as well, as far as I can > see. Thanks for any help anyone can offer. > > -Josh / eggyknap > > ______________________________________________ > 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. > ______________________________________________ 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.