# map.density: Density plot for the cloud of individuals In soc.ca: Specific Correspondence Analysis for the Social Sciences

## Description

Draws a 2d density plot on top of an existing soc.ca map. The density is calculated by the kde2d function from MASS and plotted by geom_density2d from `ggplot2` `map.density` uses the coordinates of the individuals as a basis for the density calculation. Borders are arbitrary.

## Usage

 ```1 2 3 4 5 6 7 8 9``` ```map.density( object, map = map.ind(object), group = NULL, color = "red", alpha = 0.8, size = 0.5, linetype = "solid" ) ```

## Arguments

 `object` a soc.ca class object `map` a soc.ca map object created by one of the soc.ca mapping functions `group` a factor determining group membership. Density is mapped for each group individually. `color` a single value or vector determining the color. See the scale functions of `ggplot2` for ways to alter the scales. `alpha` a single value or vector determining the alpha. `size` a single value or vector determining the size of the lines. `linetype` a single value or vector determining the linetype

## Examples

 ```1 2 3 4 5 6``` ```example(soc.ca) map.density(result, map.ind(result, dim = 2:3, point.alpha = 0.2)) map.density(result, map.ind(result, legend = TRUE, point.alpha = 0.2), group = duplicated(active), color = duplicated(active), linetype = duplicated(active)) map.density(result, map.ctr(result)) ```

### Example output

```Loading required package: ggplot2

soc.ca> data(taste)

soc.ca> # Create a data frame of factors containing all the active variables
soc.ca> taste          <- taste[which(taste\$Isup == 'Active'), ]

soc.ca> attach(taste)

soc.ca> active         <- data.frame(TV, Film, Art, Eat)

soc.ca> sup            <- data.frame(Gender, Age, Income)

soc.ca> detach(taste)

soc.ca> # Runs the analysis
soc.ca> result         <- soc.mca(active, sup)
```

soc.ca documentation built on Sept. 5, 2021, 5:21 p.m.