add_density: Density or height curves for graphs

View source: R/plots.R

add_densityR Documentation

Density or height curves for graphs

Description

Height curves show where on a plot the concentration of points is largest. In the example below we are interested in where in the network women are concentrated. We compare the density curves of the women with that of the men and we see that men are slightly more concentrated in the core of the network.

Usage

add_density(layout, ...)

Arguments

layout

a matrix with coordinates often produced by layout_with_fr

...

Examples

data(den)
den.health     <- has.tags(den, "Health", res = "den")
graph.health   <- elite.network(den.health)
graph.health   <- largest.component(graph.health)
women          <- V(graph.health)$name %in% den.health$NAME[den.health$GENDER == "Women"]
lay.health     <- layout_with_fr(graph.health, grid = "nogrid")
p              <- graph.plot(graph.health, lay.health, vertex.fill = women, edge.color = "black", edge.size = 0.3)
p              <- p + scale_fill_manual(values = c("white", "black"), name = "Women")
p + add_density(lay.health[women,], color = "darkred")
p + add_density(lay.health[women == FALSE,], color = "darkred")

antongrau/eliter documentation built on March 2, 2024, 8:05 p.m.