Visualization of hierarchical structure using containment.
Reading (Chapter 9), Recording, Rmarkdown
graph <- tbl_graph(flare$vertices, flare$edges)
p1 <- ggraph(graph, "tree") +
geom_edge_link() +
geom_node_point(aes(size = size)) +
scale_size(range = c(0.1, 5))
p2 <- ggraph(graph, "circlepack", weight = size) +
geom_node_circle(aes(fill = depth)) +
scale_fill_distiller(direction = 1) +
coord_fixed()
grid.arrange(p1, p2, ncol = 2)
Hierarchy most obviously occurs in trees, but it can also be present in networks with clustering structure at several levels. (see point 6 below).
Enclosure is used in treemaps. In this visualization, each node is allocated an area, and all its children are drawn within that area (and so on, recursively, down to the leaves).
ggraph(graph, "treemap", weight = size) +
geom_node_tile(aes(fill = depth, size = depth), size = 0.25) +
scale_fill_distiller(direction = 1) +
coord_fixed()
This is a particularly useful visualization when it’s important to visualize a continuous attribute associated with each node. For example, a large node might correspond to a large part of a budget or a large directory in a filesystem. Here is an example visualization of Obama’s budget proposal in 2013.
A caveat: treemaps are not so useful for making topological comparisons, like the distance between two nodes in the tree.
In situations where network nodes can be organized hierarchically, containment marks can directly represent the these relationships. For example, in the network below, the red and yellow clusters are contained in a green supercluster. The combination of node-link diagram and containment sets makes this structure clear.