# convex_hull: Draw different types of convex hulls around a set of points In markheckmann/convexhull: Drawing convex hulls

## Description

Draw different types of convex hulls around a set of points

## Usage

 1 2 convex_hull(x, y = NULL, alpha = 0, peel = FALSE, smooth = 0, shape = 1, draw = TRUE, ...)

## Arguments

 x,y The x and y coordinates of a set of points. Alternatively, a single argument x can be provided. alpha Proportion of points most distant from centroid to be removed before creating the (peeled) convex hull. peel Remove hull points? (useful to remove outliers, default FALSE) smooth Integer (1 to 3) indicating the method for creating splines around the hull. 0 (default) is no smooting. shape Shape parameter used for smooth=1 (see xspline for details). draw Draw the hull polygon (default TRUE). ... additional parameters passed to polygon to draw the hull.

## Value

A list as given by xy.coords containing the hull points is returned invisibly.

## Examples

 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 set.seed(2) x <- rnorm(100) y <- rnorm(100) op <- par(mfrow=c(2,3), mar=c(3,2,3,1)) plot(x,y, main="convex hull") convex_hull(x,y) plot(x,y, main="colored hull") convex_hull(x,y, col="#FF000050", density=10, angle=45, border="red") plot(x,y, main="20% of most distant\npoints removed") convex_hull(x,y, alpha=.2, col="#FF000050", density=10, angle=45, border="red") plot(x,y, main="initial hull points\nremoved (peeled off)") convex_hull(x,y, peel=TRUE, col="#00FF0050", border="red") plot(x,y, main="smoothed hull\n(spline interpolated)") convex_hull(x,y, smooth=2, col="#FF000050", border="red") plot(x,y, main="another smooting\nmethod") convex_hull(x,y, peel=TRUE, smooth=1, shape=1, col="#00FF0050", border="red") par(op)

markheckmann/convexhull documentation built on May 21, 2019, 12:06 p.m.