[R] Save generic plot to file (before rendering to device)

John Sorkin jsorkin at grecc.umaryland.edu
Mon Jul 11 19:33:19 CEST 2011


After the plot is created, you can save the graph as a pdf document (file menu, save as). You can then send the pdf file to your colleagues.
John




John David Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)>>> jeroen00ms <jeroen.ooms at stat.ucla.edu> 7/11/2011 12:08 PM >>>
I am looking for a way to save a plot (graphics contents) to a file after the
plot has been calculated but before it has been rendered. More specifically,
assume that I made a plot that took a very long time to produce, I would
like to save this plot to a generic file that I can later, on a different
machine, render to either PDF, PNG, SVG using the usual R graphics devices,
without recalculating the graphical contents.

As a toy example, suppose this is my plot function:

testplot <- function(){
  Sys.sleep(10); #very long and complicated procedure
  plot(cars);
}

So the use case is that after running testplot() which took potentially 30
days to calculate, I would like to send a file to my colleagues that they
can load in R and send to their png or pdf or svg devices just as if they
would have made the plot themselves, without having to re-run the code.


--
View this message in context: http://r.789695.n4.nabble.com/Save-generic-plot-to-file-before-rendering-to-device-tp3659999p3659999.html 
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help at 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.

Confidentiality Statement:
This email message, including any attachments, is for th...{{dropped:6}}



More information about the R-help mailing list