EVOLUTION-MANAGER
Edit File: recordplot.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Record and Replay Plots</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for recordPlot {grDevices}"><tr><td>recordPlot {grDevices}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Record and Replay Plots</h2> <h3>Description</h3> <p>Functions to save the current plot in an <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> variable, and to replay it. </p> <h3>Usage</h3> <pre> recordPlot(load=NULL, attach=NULL) replayPlot(x, reloadPkgs=FALSE) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>load</code></td> <td> <p>If not <code>NULL</code>, a character vector of package names, which are saved as part of the recorded plot.</p> </td></tr> <tr valign="top"><td><code>attach</code></td> <td> <p>If not <code>NULL</code>, a character vector of package names, which are saved as part of the recorded plot.</p> </td></tr> <tr valign="top"><td><code>x</code></td> <td> <p>A saved plot.</p> </td></tr> <tr valign="top"><td><code>reloadPkgs</code></td> <td> <p>A logical indicating whether to reload and/or reattach any packages that were saved as part of the recorded plot.</p> </td></tr> </table> <h3>Details</h3> <p>These functions record and replay the displaylist of the current graphics device. The returned object is of class <code>"recordedplot"</code>, and <code>replayPlot</code> acts as a <code>print</code> method for that class. </p> <p>The returned object is stored as a pairlist, but the usual methods for examining <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> objects such as <code><a href="../../base/html/deparse.html">deparse</a></code> and <code><a href="../../utils/html/str.html">str</a></code> are liable to mislead. </p> <h3>Value</h3> <p><code>recordPlot</code> returns an object of class <code>"recordedplot"</code>. </p> <p><code>replayPlot</code> has no return value. </p> <h3>Warning</h3> <p>The format of recorded plots may change between <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> versions, so recorded plots should <strong>not</strong> be used as a permanent storage format for <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> plots. </p> <p>As of <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> 3.3.0, it is possible (again) to replay a plot from another <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> session using, for example, <code><a href="../../base/html/readRDS.html">saveRDS</a></code> and <code><a href="../../base/html/readRDS.html">readRDS</a></code>. It is even possible to replay a plot from another <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> version, however, this will produce warnings, may produce errors, or something worse. </p> <h3>Note</h3> <p>Replay of a recorded plot may not produce the correct result (or may just fail) if the display list contains a call to <code><a href="recordGraphics.html">recordGraphics</a></code> which in turn contains an expression that calls code from a non-base package other than <span class="pkg">graphics</span> or <span class="pkg">grid</span>. The most well-known example of this is a plot drawn with the package <a href="https://CRAN.R-project.org/package=ggplot2"><span class="pkg">ggplot2</span></a>. One solution is to load the relevant package(s) before replaying the recorded plot. The <code>load</code> and <code>attach</code> arguments to <code>recordPlot</code> can be used to automate this - any packages named in <code>load</code> will be reloaded, via <code><a href="../../base/html/ns-load.html">loadNamespace</a></code>, and any packages named in <code>attach</code> will be reattached, via <code><a href="../../base/html/library.html">library</a></code>, as long as <code>reloadPkgs</code> is <code>TRUE</code> in the call to <code>replayPlot</code>. This is only relevant when attempting to replay in one R session a plot that was recorded in a different R session. </p> <h3>See Also</h3> <p>The displaylist can be turned on and off using <code><a href="dev2.html">dev.control</a></code>. Initially recording is on for screen devices, and off for print devices. </p> <hr /><div style="text-align: center;">[Package <em>grDevices</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>