viz_hull: Convex Hulls

viz_hullR Documentation

Convex Hulls

Description

Plots convex hull of a set of observations.

Usage

viz_hull(x, ...)

wrap_hull(x, ...)

## S4 method for signature 'MultivariateAnalysis'
viz_hull(
  x,
  ...,
  margin = 1,
  axes = c(1, 2),
  group = NULL,
  color = NULL,
  fill = FALSE,
  symbol = FALSE
)

## S4 method for signature 'BootstrapCA'
viz_hull(
  x,
  ...,
  margin = 1,
  axes = c(1, 2),
  color = FALSE,
  fill = FALSE,
  symbol = FALSE
)

## S4 method for signature 'PCOA'
viz_hull(
  x,
  ...,
  axes = c(1, 2),
  group = NULL,
  color = FALSE,
  fill = FALSE,
  symbol = FALSE
)

## S4 method for signature 'MultivariateAnalysis'
wrap_hull(x, margin = 1, axes = c(1, 2), group = NULL)

## S4 method for signature 'PCOA'
wrap_hull(x, axes = c(1, 2), group = NULL)

Arguments

x

An object from which to wrap observations (a CA, MCA or PCA object).

...

Further graphical parameters to be passed to graphics::polygon().

margin

A length-one numeric vector giving the subscript which the data will be returned: 1 indicates individuals/rows (the default), 2 indicates variables/columns.

axes

A length-two numeric vector giving the dimensions for which to compute results.

group

A vector specifying the group an observation belongs to.

color

The colors for borders (will be mapped to group). Ignored if set to FALSE. If NULL, the default color scheme will be used.

fill

The background colors (will be mapped to group). Ignored if set to FALSE.

symbol

A vector of symbols (will be mapped to group). Ignored if set to FALSE.

Value

wrap_hull() returns a data.frame of envelope x and y coordinates. An extra column named group is added specifying the group an observation belongs to.

viz_hull()is called for its side-effects: it results in a graphic being displayed. Invisibly returns x.

Author(s)

N. Frerebeau

See Also

Other envelopes: viz_confidence(), viz_ellipses(), viz_tolerance()

Examples

## Load data
data("iris")

## Compute principal components analysis
X <- pca(iris, scale = TRUE, sup_quali = "Species")

## Compute convex hull coordinates
hulls <- wrap_hull(X, margin = 1, group = "Species")

## Plot convex hulls
col <- c("#004488", "#DDAA33", "#BB5566")
viz_rows(X, extra_quali = iris$Species, color = col)
viz_hull(X, group = iris$Species, color = col)

dimensio documentation built on April 3, 2025, 10:36 p.m.