Learn R Programming

dimensio (version 0.13.0)

viz_ellipses: Ellipses

Description

Plots ellipses.

Usage

viz_ellipses(x, ...)

# S4 method for MultivariateAnalysis viz_ellipses( x, ..., group = NULL, type = c("tolerance", "confidence"), level = 0.95, margin = 1, axes = c(1, 2), color = NULL, fill = FALSE, symbol = FALSE )

# S4 method for PCOA viz_ellipses( x, ..., group = NULL, type = c("tolerance", "confidence"), level = 0.95, axes = c(1, 2), color = NULL, fill = FALSE, symbol = FALSE )

Value

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

Arguments

x

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

...

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

group

A vector specifying the group an observation belongs to.

type

A character string specifying the ellipse to draw. It must be one of "tolerance" or "confidence"). Any unambiguous substring can be given.

level

A numeric vector specifying the confidence/tolerance level.

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.

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.

Author

N. Frerebeau

See Also

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

Examples

Run this code
## Load data
data("iris")

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

## Plot with tolerance ellipses
col <- c("#004488", "#DDAA33", "#BB5566")
viz_rows(X, extra_quali = iris$Species, color = col)
viz_ellipses(
  x = X,
  type = "tolerance",
  level = c(0.68, 0.95),
  group = iris$Species,
  color = col
)

Run the code above in your browser using DataLab