# NOT RUN {
# 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)
}
# }
Run the code above in your browser using DataLab