ahull2poly | R Documentation |
Convert alpha hull to SpatialPolygon
ahull2poly(hull)
hull |
The alpha hull object |
The SpatialPolygon object created by that alpha hull
data(iris)
iris_sepals <- iris[,1:2]
iris_sepals <- iris_sepals[!duplicated(paste(iris_sepals$Sepal.Length, iris_sepals$Sepal.Width)), ]
alphahull_1 <- alphahull::ahull(iris_sepals, alpha = 1)
hullpoly_1 <- ahull2poly(alphahull_1)
plot(iris_sepals, pch = 19, col = "darkseagreen")
plot(alphahull_1, lwd = 5, col = "gray", add = TRUE)
sp:::plot.SpatialPolygons(hullpoly_1, border = "magenta", add = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.