# polygon2: polygon2 In raredd/plotr: More plotting functions and examples

## Description

Draw regular `polygon`s as plotting characters. This function calculates the `{x,y}` coordinates for given centroids and radii and passes each pair of vectors to `polygon` to draw. Note that all arguments except `x`, `y`, `radius`, `sides`, and `srt` are passed directly to `polygon`, so see `?polygon` for additional details.

## Usage

 ```1 2 3``` ```polygon2(x, y = NULL, radius, sides = 6, srt = 0, density = NULL, angle = 45, border = NULL, col = NA, lty = par("lty"), fillOddEven = FALSE, ...) ```

## Arguments

 `x, y` x- and y-coordinate vectors of polygon centroids `radius` distance from centroid to each vertex `sides` number of sides for polygons; since only regular polygons may be plotted, possible values are `(1:360)[360L %% 1:360 == 0L]` `srt` rotation in degrees for polygon `density` density of shading lines in lines per inch `angle` slope of shading lines, given as an angle in degrees (counter- clockwise) `border` polygon border color `col` polygon fill color `lty` line type to be used for border and/or shading lines `fillOddEven` logical controlling polygon shading mode `...` additional graphical parameters such as `xpd`, `lend`, `ljoin`, and `lmitre` passed to `par`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13``` ```## sides can be any of (sides <- (1:360)[360L %% 1:360 == 0L]) plot.new() for (ii in sides) polygon2(0.5, 0.5, sides = ii) ## okay # polygon2(0.5, 0.5, sides = 7) ## error x <- mtcars\$mpg y <- mtcars\$wt plot(x, y, type = 'n', asp = 1) polygon2(x, y, density = 30, angle = 90, col = mtcars\$gear) polygon2(x, y + 1, srt = 30, lty = 'dotted', col = 'transparent') polygon2(x, y + -2, radius = .5, sides = 5) ```

raredd/plotr documentation built on Dec. 6, 2018, 6:59 a.m.