[R] Recalling and printing multiple graphs. Is there something in the HISTORY menu that will help?

Mike Prager mike.prager at noaa.gov
Tue Mar 6 23:04:44 CET 2007


"John Sorkin" <jsorkin at grecc.umaryland.edu> wrote:

> I have written an R function that produces multiple graphs. I use
> par(ask=TRUE) to allow for the inspection of each graph before the next
> graph is drawn. I am looking for a way to recall all graphs drawn in an
> R session, and a method that can be used to print all the graphs at one
> time. I know that I could simply print each graph after I inspect the
> graph, but this gets tiresome if one's function produces tens of graphs.
> I suspect that if I knew more about the history menu (which currently
> has an entry RECORDING) I could get the graphs to be replayed and
> printed, but alas I have not been able to find instructions for using
> the HISTORY menu. Please take pity on my  when you let me know that some
> easy search or command could get me the information I needed. I have
> looked, but clearly in the wrong places.
>  
> John Sorkin M.D., Ph.D.

I assume you are on Windows (please give OS and R version in
future help requests).  

The code I use before starting such functions is

graphics.off()
windows(record=TRUE)
.SavedPlots <- NULL

which closes existing graphics devices, opens a windows device
with recording on, and deletes any existing graphics history.

You can go through the history with PageUp and PageDown keys.

Within your function, you can call savePlot (q.v.) to save each
plot to a file just after it is generated.

HTH

-- 
Mike Prager, NOAA, Beaufort, NC
* Opinions expressed are personal and not represented otherwise.
* Any use of tradenames does not constitute a NOAA endorsement.



More information about the R-help mailing list