View source: R/voronoiPolygons.R
voronoiPolygons | R Documentation |
For construction and plotting of Delaunay and Voronoi polygons.
voronoiPolygons(sites, rw.data = NULL, rw = NULL, type = "tiles",
output = "vertices", latlong = FALSE)
sites |
Object. Data frame of sites to compute Delaunay triangulation and Dirichelet (Voronoi) tessellation with variables "x" and "y". |
rw.data |
Object. Data frame of secondary source of data to set the rectangular window or bounding box: observations, cases, etc. with variables "x" and "y". |
rw |
Numeric. Alternative to rw.data: vector of corners to define the rectangular window or bounding box: xmin, xmax, ymin, ymax. |
type |
Character. "tiles" (tessellation) or "triangles" (triangulation) vertices. |
output |
Character. "vertices" or "polygons". "vertices" re "polygons" will draw base R polygons() to an existing plot. |
latlong |
Logical. Use estimated longitude and latitude. |
An R list of data frames or base R graphics polygon()'s'.
This function relies on the 'deldir' package.
snowMap()
voronoiPolygons(pumps, output = "polygons")
snowMap()
voronoiPolygons(pumps, roads, output = "polygons")
snowMap()
voronoiPolygons(pumps, roads, type = "triangles", output = "polygons")
vertices <- voronoiPolygons(pumps, roads)
snow.colors <- grDevices::adjustcolor(snowColors(), alpha.f = 1/3)
snowMap(add.cases = FALSE)
invisible(lapply(seq_along(vertices), function(i) {
polygon(vertices[[i]], col = snow.colors[[i]])
}))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.