EVOLUTION-MANAGER
Edit File: grid.force.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: Force a grob into its components</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 grid.force {grid}"><tr><td>grid.force {grid}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2> Force a grob into its components </h2> <h3>Description</h3> <p>Some grobs only generate their content to draw at drawing time; this function replaces such grobs with their at-drawing-time content. </p> <h3>Usage</h3> <pre> grid.force(x, ...) ## Default S3 method: grid.force(x, redraw = FALSE, ...) ## S3 method for class 'gPath' grid.force(x, strict = FALSE, grep = FALSE, global = FALSE, redraw = FALSE, ...) ## S3 method for class 'grob' grid.force(x, draw = FALSE, ...) forceGrob(x) grid.revert(x, ...) ## S3 method for class 'gPath' grid.revert(x, strict = FALSE, grep = FALSE, global = FALSE, redraw = FALSE, ...) ## S3 method for class 'grob' grid.revert(x, draw = FALSE, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>For the default method, <code>x</code> should not be specified. Otherwise, <code>x</code> should be a grob or a gPath. If <code>x</code> is character, it is assumed to be a gPath. </p> </td></tr> <tr valign="top"><td><code>strict</code></td> <td> <p>A boolean indicating whether the <code>path</code> must be matched exactly. </p> </td></tr> <tr valign="top"><td><code>grep</code></td> <td> <p>Whether the <code>path</code> should be treated as a regular expression. </p> </td></tr> <tr valign="top"><td><code>global</code></td> <td> <p>A boolean indicating whether the function should affect just the first match of the <code>path</code>, or whether all matches should be affected. </p> </td></tr> <tr valign="top"><td><code>draw</code></td> <td> <p>logical value indicating whether a grob should be drawn after it is forced. </p> </td></tr> <tr valign="top"><td><code>redraw</code></td> <td> <p>logical value indicating whether to redraw the <span class="pkg">grid</span> scene after the forcing operation. </p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p> Further arguments for use by methods. </p> </td></tr> </table> <h3>Details</h3> <p>Some grobs wait until drawing time to generate what content will actually be drawn (an axis, as produced by <code>grid.xaxis()</code>, with an <code>at</code> or <code>NULL</code> is a good example because it has to see what viewport it is going to be drawn in before it can decide what tick marks to draw). </p> <p>The content of such grobs (e.g., the tick marks) are not usually visible to <code>grid.ls()</code> or accessible to <code>grid.edit()</code>. </p> <p>The <code>grid.force()</code> function <em>replaces</em> a grob with its at-drawing-time contents. For example, an axis will be replaced by a vanilla gTree with lines and text representing the axis tick marks that were actually drawn. This makes the tick marks visible to <code>grid.ls()</code> and accessible to <code>grid.edit()</code>. </p> <p>The <code>forceGrob()</code> function is the internal work horse for <code>grid.force()</code>, so will not normally be called directly by the user. It is exported so that methods can be written for custom grob classes if necessary. </p> <p>The <code>grid.revert()</code> function reverses the effect of <code>grid.force()</code>, replacing forced content with the original grob. </p> <h3>Warning</h3> <p>Forcing an explicit grob produces a result as if the grob were drawn in the <em>current</em> drawing context. It may not make sense to draw the result in a different drawing context. </p> <h3>Note</h3> <p>These functions only have an effect for grobs that generate their content at drawing time using <code>makeContext()</code> and <code>makeContent()</code> methods (<em>not</em> for grobs that generate their content at drawing time using <code>preDrawDetails()</code> and <code>drawDetails()</code> methods). </p> <h3>Author(s)</h3> <p> Paul Murrell </p> <h3>Examples</h3> <pre> grid.newpage() pushViewport(viewport(width=.5, height=.5)) # Draw xaxis grid.xaxis(name="xax") grid.ls() # Force xaxis grid.force() grid.ls() # Revert xaxis grid.revert() grid.ls() # Draw and force yaxis grid.force(yaxisGrob(), draw=TRUE) grid.ls() # Revert yaxis grid.revert() grid.ls() # Force JUST xaxis grid.force("xax") grid.ls() # Force ALL grid.force() grid.ls() # Revert JUST xaxis grid.revert("xax") grid.ls() </pre> <hr /><div style="text-align: center;">[Package <em>grid</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>