Description Usage Arguments Examples

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.

1 2 3 |

`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 |

`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 |

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 Nov. 19, 2018, 11:02 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.