View source: R/heat_tree--shape_generators.R
polygon_coords | R Documentation |
Generates an n x 2 matrix containing x and y coordinates between 1 and 0 for the points of a regular polygon.
polygon_coords(n = 5, x = 0, y = 0, radius = 1, angle = 0)
n |
( |
x |
( |
y |
( |
radius |
( |
angle |
( |
Inspired by (i.e. stolen from) https://gist.github.com/baptiste/2224724, which was itself inspired from a post by William Dunlap on r-help (10/09/09)
## Not run:
library(ggplot2)
ggplot(data = polygon_coords(n = 4:13, x = rnorm(10), y = rnorm(10), radius = .5)) +
geom_polygon(aes(x = x, y = y, fill = group))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.