[R] Save generic plot to file (before rendering to device)
Greg.Snow at imail.org
Mon Jul 11 22:08:05 CEST 2011
Note the warning on the help page for recordPlot. If your colleague is using a different version of R than you there could be problems.
Another approach (or the start to one that you could build on) is the plot2script function in the TeachingDemos package (which uses recordPlot internally).
But it is probably best to save the resulting data from the long process, that could then be quickly plotted as others have mentioned.
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
greg.snow at imail.org
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Jeroen Ooms
> Sent: Monday, July 11, 2011 12:22 PM
> To: David Winsemius
> Cc: r-help at r-project.org
> Subject: Re: [R] Save generic plot to file (before rendering to device)
> > You can also save a data (or function) object to an .Rdata file with
> > save(objname, file="filename.Rdata") and your colleagues could then
> > load("filename.Rdata") in R.
> Thanks for the responses. I found an old post by Gabor Grothendieck
> shows what I want. Basically the trick is to save the displaylist to an
> dev.control(displaylist="enable") # enable display list
> myplot <- recordPlot() # load displaylist into variable
> You can now store myplot and later fetch it and play it back via
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help