Create a voronoi tiling geom
gs_voronoi(anchor = NULL, window = NULL, features = 3, ...)
anchor | [ |
---|---|
window | [ |
features | [ |
... | [various] |
A geom
.
Other tilings:
gs_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 <- gs_point(anchor = coords, window = window) visualise(voronoi = aGeom, linecol = "deeppink") tiles <- gs_voronoi(anchor = aGeom) visualise(tiles, new = FALSE) # 2. sketch a voronoi polygon if(dev.interactive()){ tiles <- gs_voronoi() visualise(tiles, new = FALSE) }