geo_voronoi | R Documentation |
geom
Create a voronoi tiling geom
geo_voronoi(crds = NULL, window = NULL, features = 3)
crds |
data.frame(2) |
window |
data.frame(2) |
features |
integerish(1) |
A geom
.
Other tilings:
geo_tiles()
# 1. create voronoi polygons programmatically
coords <- data.frame(x = c(40, 70, 70, 50),
y = c(40, 40, 60, 70))
window <- data.frame(x = c(0, 80),
y = c(0, 80))
aGeom <- geo_point(crds = coords, window = window)
geo_vis(voronoi = aGeom, linecol = "deeppink")
tiles <- geo_voronoi(crds = coords, window = window)
geo_vis(tiles, new = FALSE)
# 2. sketch a voronoi polygon
if(dev.interactive()){
tiles <- geo_voronoi()
geo_vis(tiles, new = FALSE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.