Regular polygons and ellipses in grid graphics
Baptiste Auguie
2022-12-11
ngonGrob.rmd
The gridExtra
package provides a basic implementation of
regular polygons, ngonGrob()/grid.ngon
, and a convenience
function to draw ellipses, ellipseGrob()/grid.ellipse()
. We
illustrate below the basic usage of these vectorised functions.
Ellipses
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/N+pi/2,
size=5, ar=3, gp=gpar(fill=1:N))
grid.newpage()
grid.draw(g3)