EVOLUTION-MANAGER
Edit File: ngonGrob.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: Regular polygon grob</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 ngonGrob {gridExtra}"><tr><td>ngonGrob {gridExtra}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Regular polygon grob</h2> <h3>Description</h3> <p>Regular polygons with optional rotation, stretching, and aesthetic attributes. </p> <h3>Usage</h3> <pre> ngonGrob(x, y, n = 5, size = 5, phase = pi/2, angle = 0, ar = 1, gp = gpar(colour = "black", fill = NA, linejoin = "mitre"), ..., position.units = "npc", size.units = "mm") grid.ngon(...) ellipseGrob(x, y, size = 5, angle = pi/4, ar = 1, n = 50, gp = gpar(colour = "black", fill = NA, linejoin = "mitre"), ..., position.units = "npc", size.units = "mm") grid.ellipse(...) polygon_regular(n = 5, phase = 0) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>x unit</p> </td></tr> <tr valign="top"><td><code>y</code></td> <td> <p>y unit</p> </td></tr> <tr valign="top"><td><code>n</code></td> <td> <p>number of vertices</p> </td></tr> <tr valign="top"><td><code>size</code></td> <td> <p>radius of circumscribing circle</p> </td></tr> <tr valign="top"><td><code>phase</code></td> <td> <p>angle in radians of first point relative to x axis</p> </td></tr> <tr valign="top"><td><code>angle</code></td> <td> <p>angle of polygon in radians</p> </td></tr> <tr valign="top"><td><code>ar</code></td> <td> <p>aspect ratio</p> </td></tr> <tr valign="top"><td><code>gp</code></td> <td> <p>gpar</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>further parameters passed to polygonGrob</p> </td></tr> <tr valign="top"><td><code>position.units</code></td> <td> <p>default units for the positions</p> </td></tr> <tr valign="top"><td><code>size.units</code></td> <td> <p>grid units for the sizes</p> </td></tr> </table> <h3>Value</h3> <p>A grob. </p> <h3>Functions</h3> <ul> <li> <p><code>ngonGrob</code>: return a polygon grob </p> </li> <li> <p><code>grid.ngon</code>: draw a polygon grob on the current device </p> </li> <li> <p><code>ellipseGrob</code>: return an ellipse grob </p> </li> <li> <p><code>grid.ellipse</code>: draw an ellipse grob </p> </li> <li> <p><code>polygon_regular</code>: return the x,y coordinates of a regular polygon inscribed in the unit circle </p> </li></ul> <h3>Examples</h3> <pre> library(grid) N <- 5 xy <- polygon_regular(N)*2 # draw multiple polygons g <- ngonGrob(unit(xy[,1],"cm") + unit(0.5,"npc"), unit(xy[,2],"cm") + unit(0.5,"npc"), n = seq_len(N) + 2, gp = gpar(fill=1:N)) grid.newpage() grid.draw(g) # rotated and stretched g2 <- ngonGrob(unit(xy[,1],"cm") + unit(0.5,"npc"), unit(xy[,2],"cm") + unit(0.5,"npc"), n = seq_len(N) + 2, ar = seq_len(N), phase = 0, angle = pi/(seq_len(N) + 2), size = 1:N + 5) grid.newpage() grid.draw(g2) # ellipse g3 <- ellipseGrob(unit(xy[,1],"cm") + unit(0.5,"npc"), unit(xy[,2],"cm") + unit(0.5,"npc"), angle = -2*seq(0,N-1)*pi/5 + pi/2, size = 5, ar = 1/3) grid.newpage() grid.draw(g3) </pre> <hr /><div style="text-align: center;">[Package <em>gridExtra</em> version 2.3 <a href="00Index.html">Index</a>]</div> </body></html>