Examples for 'grid::grid.polygon'


Draw a Polygon

Aliases: grid.polygon polygonGrob

Keywords: dplot

### ** Examples

grid.polygon()
plot of chunk example-grid-grid.polygon-1
# Using id (NOTE: locations are not in consecutive blocks)
grid.newpage()
grid.polygon(x=c((0:4)/10, rep(.5, 5), (10:6)/10, rep(.5, 5)),
             y=c(rep(.5, 5), (10:6/10), rep(.5, 5), (0:4)/10),
             id=rep(1:5, 4),
             gp=gpar(fill=1:5))
plot of chunk example-grid-grid.polygon-1
# Using id.lengths
grid.newpage()
grid.polygon(x=outer(c(0, .5, 1, .5), 5:1/5),
             y=outer(c(.5, 1, .5, 0), 5:1/5),
             id.lengths=rep(4, 5),
             gp=gpar(fill=1:5))
plot of chunk example-grid-grid.polygon-1

[Package grid version 4.2.3 Index]