add.ellipse: Add a layer with concentration ellipses to an mca map.

View source: R/functions_build_plot.r

add.ellipseR Documentation

Add a layer with concentration ellipses to an mca map.

Description

Add a layer with concentration ellipses to an mca map.

Usage

add.ellipse(
  object,
  var = NULL,
  draw = unique(var),
  dim = c(1, 2),
  el = ellipses(object, var = var, dim = dim),
  mapping = aes(color = Category),
  draw.axis = TRUE,
  ...
)

Arguments

object

a soc.mca result object

var

a factor

draw

a character vector with the levels to draw ellipses for

dim

a numeric vector with the dimensions for the plane

el

a data.frame produced by the ellipses function.

mapping

a call to aes from the ggplot2 package. Here you can map aesthetics to variables such as color, fill, alpha, size and linetype.

draw.axis

if TRUE the axis within the concentration ellipse is drawn.

...

further arguments is passed onto geom_path and geom_line

Value

a ggplot2 object that can be added to an existing plot like those produced by map.ca.base

Examples

example(soc.mca)
map.ca.base() + add.ind(result, mapping = aes(color = sup$Gender)) + add.ellipse(result, sup$Gender)
map.ca.base() + add.ind(result, mapping = aes(color = sup$Age == "65+")) + add.ellipse(result, sup$Age == "65+", draw = "TRUE")

Rsoc/soc.ca documentation built on March 7, 2024, 8:59 p.m.