View source: R/ggcloud_indiv.R

ggcloud_indiv | R Documentation |

Plots a Multiple Correspondence Analysis cloud of individuals, using ggplots functions.

ggcloud_indiv(resmca, type='i', points='all', axes=1:2, col='dodgerblue4', palette='Set2', size = 0.5, alpha=0.6, repel=FALSE, density=NULL, col.contour="darkred", hex.bins=50, hex.pal="viridis")

`resmca` |
object of class |

`type` |
If 'i', points are plotted; if 'inames', labels of individuals are plotted. |

`points` |
character string. If 'all' all points are plotted (default); if 'besth' only those who contribute most to horizontal axis are plotted; if 'bestv' only those who contribute most to vertical axis are plotted; if 'best' only those who contribute most to horizontal or vertical axis are plotted. |

`axes` |
numeric vector of length 2, specifying the components (axes) to plot. Default is c(1,2). |

`col` |
If a factor, points or labels are colored according to their category regarding this factor. If a string with color name, every points or labels have the same color. Default is 'dodgerblue4'. |

`palette` |
If |

`size` |
Size of the points or labels of individuals. Default is 0.5. |

`alpha` |
Transparency of the points or labels of individuals. Default is 0.6. |

`repel` |
Logical. When type='inames', should labels of individuals be repeled ? Default is FALSE. |

`density` |
If NULL (default), no density layer is added. If "contour", density is plotted with contours. If "hex", density is plotted with hexagon bins. |

`col.contour` |
character string. The color of the contours. Only used if density="contour". |

`hex.bins` |
integer. The number of bins in both vertical and horizontal directions. Only used if density="hex". |

`hex.pal` |
character string. The name of a viridis palette for hexagon bins. Only used if density="hex". |

Sometimes the dots are too many and overlap. It is then difficult to get an accurate idea of the distribution of the cloud of individuals. The "density" option allows you to add an additional layer to represent the density of points in the plane, in the form of contours or hexagonal areas.

a ggplot object

Anton Perdoncin, Nicolas Robette

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).

`ggcloud_variables`

, `ggadd_ellipses`

, `ggadd_supvar`

, `ggadd_corr`

, `ggadd_interaction`

, `ggadd_density`

## Performs a specific MCA on 'Taste' example data set ## ignoring every 'NA' (i.e. 'not available') categories, ## and then draws the cloud of individuals. data(Taste) getindexcat(Taste[,1:11]) mca <- speMCA(Taste[,1:11],excl=c(3,6,9,12,15,18,21,24,27,30,33)) ggcloud_indiv(mca) # Points are colored according to gender ggcloud_indiv(mca, col=Taste$Gender, palette='Set2') # A density layer of contours is added ggcloud_indiv(mca, density="contour") # A density layer of hexagon bins is added ggcloud_indiv(mca, density="hex", hex.bin=10)

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.