Learn R Programming

mdatools (version 0.14.2)

plotConvexHull: Add convex hull for groups of points on scatter plot

Description

The method shows convex hull for groups of points on a scatter plot made using `mdaplot()` function with `cgroup` parameter. It will work only if `cgroup` is a factor.

Usage

plotConvexHull(p, lwd = 1, lty = 1, opacity = 0)

Arguments

p

plot data returned by function `mdaplot()`.

lwd

thickness of line used to show the hull.

lty

type of line used to show the hull.

opacity

of opacity is larger than 0 a semi-transparent polygon is shown over points.

Examples

Run this code
# adds convex hull with semi-transparent area over two clusters of points

library(mdatools)
data(people)
group <- factor(people[, "Sex"], labels = c("Male", "Female"))

p <- mdaplot(people, type = "p", cgroup = group)
plotConvexHull(p)

Run the code above in your browser using DataLab