ggadd_chulls.Rd
Adds convex hulls for a categorical variable to a MCA cloud of individuals.
ggplot2
object with the cloud of individuals
object of class MCA
, speMCA
, csMCA
, stMCA
or multiMCA
Factor. The categorical variable used to plot chulls.
numeric vector of indexes of the categories to plot (by default, ellipses are plotted for every categories)
numeric vector of length 2, specifying the components (axes) to plot. Default is c(1,2).
proportion of all the points to be included in the hull (default is 1).
Numerical value from 0 to 1. Transparency of the polygon's fill. Default is O.2
Logical. Should the labels of the categories be plotted at the center of chulls ? Default is TRUE.
Size of the labels of the categories at the center of chulls. Default is 5.
the position of legends ("none", "left", "right", "bottom", "top", or two-element numeric vector). Default is right.
a ggplot2
object
Chulls are colored according to the categories of the variable, using the default ggplot2
palette. The palette can be customized using any scale_color_*
and scale_fill_*
functions, such as scale_color_brewer()
and scale_fill_brewer()
, scale_color_grey()
and scale_fill_grey()
, or scale_color_manual()
and scale_fill_manual()
.
Le Roux B. and Rouanet H., Multiple Correspondence Analysis, SAGE, Series: Quantitative Applications in the Social Sciences, Volume 163, CA:Thousand Oaks (2010).
Le Roux B. and Rouanet H., Geometric Data Analysis: From Correspondence Analysis to Stuctured Data Analysis, Kluwer Academic Publishers, Dordrecht (June 2004).
# specific MCA of Taste example data set
data(Taste)
junk <- c("FrenchPop.NA", "Rap.NA", "Rock.NA", "Jazz.NA", "Classical.NA",
"Comedy.NA", "Crime.NA", "Animation.NA", "SciFi.NA", "Love.NA",
"Musical.NA")
mca <- speMCA(Taste[,1:11], excl = junk)
# hierarchical clustering
# and partition of the individuals into 3 clusters
d <- dist(mca$ind$coord[, c(1,2)])
hca <- hclust(d, "ward.D2")
cluster <- factor(cutree(hca, 3))
# cloud of individuals
# with convex hulls for the clusters.
p <- ggcloud_indiv(mca, col = "black")
ggadd_chulls(p, mca, cluster)