Draw a polygons around a certains set of points.

encircle(x, y = NULL, nb.pt = 20, off.set = 1, ...)

Arguments

x

the x coordinates of a set of points. Alternatively, a single argument x can be provided.

y

the y coordinates of a set of points.

nb.pt

the number of points to be generated around each coordinates.

off.set

the y coordinates of a set of points.

...

further arguments to be passed to graphics::polygon() function.

Details

The technique employed is fairly simple: for a set of coordinates x, y handled using xy.coords a set of nb.pt number is generated at a off.set distance of each coordinates, then a convex is drawn around the coordinates using grDevices::chull().

Examples

coords <- cbind(runif(10), runif(10)) plot0(coords)
points(coords, bg='grey25', pch=21)
encircle(coords, border='#7b11a1', lwd=2)