>
> That warning is necessarily rather pessimistic.  We haven't changed the
> format for several years.  But we might, without notice.
>

Thank you, this is very helpful. One final question regarding this method:
suppose a function prints multiple plots, i.e. multiple pages to a PDF. Is
it possible to record all of these plots at once? The code below only
records the final plot. I would like to record all of them, without
modifying myfn:

myfn <- function(mylm){
  plot(mylm, ask=F)
}

mylm <- lm(dist~speed, data=cars);

pdf(tempfile())
dev.control(displaylist="enable")
myfn(mylm);
myplots <- recordPlot()
dev.off()

save(myplot, file="myplot.RData")






>
>
>
>> 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
>> Intermountain Healthcare
>> greg.s...@imail.org
>> 801.408.8111
>>
>>
>>  -----Original Message-----
>>> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
>>> project.org] On Behalf Of Jeroen Ooms
>>> Sent: Monday, July 11, 2011 12:22 PM
>>> To: David Winsemius
>>> Cc: r-help@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
>>> that
>>> shows what I want. Basically the trick is to save the displaylist to an
>>> object:
>>>
>>> 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
>>>
>>> print(myplot)
>>>
>>>        [[alternative HTML version deleted]]
>>>
>>> ______________________________**________________
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
>>> PLEASE do read the posting guide 
>>> http://www.R-project.org/**posting-<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<https://stat.ethz.ch/mailman/listinfo/r-help>
>> PLEASE do read the posting guide http://www.R-project.org/**
>> posting-guide.html <http://www.R-project.org/posting-guide.html>
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
> --
> Brian D. Ripley,                  rip...@stats.ox.ac.uk
> Professor of Applied Statistics,  
> http://www.stats.ox.ac.uk/~**ripley/<http://www.stats.ox.ac.uk/~ripley/>
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>

        [[alternative HTML version deleted]]

______________________________________________
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