[R] Use of recordPlot

From: Beck, Kenneth (STP) <Kenneth.Beck_at_bsci.com>
Date: Mon, 21 Apr 2008 17:09:30 -0500


I am trying to save plots that I create using calls to windows() folowed by multiple calls to plot to place several plots on a page. I want to store the plots as variables to be able to recall them later. The documentation states:
"Recorded plot histories are of class "SavedPlots". They have a print method, and a subset method.
As the individual plots are of class "recordedplot" they can be replayed by printing them: see recordPlot.
The active plot history is stored in variable .SavedPlots in the workspace."

But what does this mean "class SavedPlots"? Is class similar to a class in C++?
Where are the plot() and metafile(), etc methods for this class? And if it is saved as a SavedPlots class, then what is a "recordedplot" class?
Why the two names? Finally, the .SavedPlots does not appear in my workspace at all.
Where did it go?

Here is a code snippet, why does this not work: windows();
nf1 <- layout(matrix(1), widths=lcm(6), heights=lcm(6))
par(mfrow=c(2,2));

par (mfg=c(1,1));
plot( ...some stuff...);
par (mfg=c(1,2);
plot(....some more stuff...)
par (mfg=c(2,1);
plot(....some more stuff...)
par (mfg=c(2,2);
plot(....some more stuff...)

plot_save=recordPlot();

# now some more code, doing other stuff, maybe more plots
# now try to replay the saved plot:

replayPlot(plot_save)

This last line gives the following error: Error in replayPlot(plot_save) :
  A clipboard metafile can store only one figure.

The documentation says that replayPlot() has a print method, so let's try that: we get the following error:
Error: unexpected symbol in "replayPlot(lm_hr_plot).print"

Can someone help me understand this, and get routines to save and replay plots?

Thanks in advance...



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. Received on Mon 21 Apr 2008 - 22:13:07 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 22 Apr 2008 - 16:30:30 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive