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