Description Usage Arguments Examples
View source: R/functions_plot.r
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.
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"
)
|
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 |
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 |
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))
|
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.