Learn R Programming

soc.ca (version 0.8.1)

add.ellipse: 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,
  ...
)

Value

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

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

Examples

Run this code
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")

Run the code above in your browser using DataLab