add.categories: Add a layer of categories (modalities) to an mca map

View source: R/functions_build_plot.r

add.categoriesR Documentation

Add a layer of categories (modalities) to an mca map

Description

Add a layer of categories (modalities) to an mca map

Usage

The presets adds, replaces or filters from the categories in cats.
  "ctr" returns all categories contributing above average to the plane
  defined in dim. "sup" returns the supplementary categories from object.
  "all" returns both supplementary and active categories.

Arguments

object

a soc.mca result object

preset

a character string selecting among presets. If "active" - no change is made to "cats".

dim

a numeric vector with the dimensions for the plane

cats

a data.frame with coordinates of categories as produced by extract_mod or extract_sup. This controls the plotted points.

mapping

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

repel

if TRUE label position is adjusted to lower overlap

check_overlap

if TRUE overlapping categories are removed

points

if TRUE points are plotted

...

further arguments are passed onto geom_text or geom_text_repel

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.categories(result, check_overlap = TRUE)
map.ca.base() + add.categories(result, preset = "all", mapping = aes(color = type, label = Modality), repel = TRUE)

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