This page follows the previous introduction to hierarchical edge bundling. It considers you understood what inputs you need and how to build a basic version. it aims to describe how we can improve it, to get the above figure. First, we remember the R code allowing to get the previous basic version:

The first thing we can play with is the tension of the connections. A tension of 0 means straight lines. A connection of 1 means maximal curvature: the connections follow the hierarchical structure of the network as much as they can. Let’s have a look to the effect of different values.

Then we can play with the colour and transparency of connections. We have seen how to pick up a unique color in the example above. We can also map a specific variable to it like we are used to do with ggplot2 (chart 1 and 2 below)! Another possibility is to make the color evolves along the trajectory: the ‘from’ and the ‘to’ have different color. This is useful if your connection is directed, and gives the nice effect figure 4.

Finally we can custom the points as well, like for a classic ggplot2 graphic. It is a good practice to make the color depends of the classification of the point, it allows to make the hierarchy more obvious. In the last example, I map a column to the size of the points!

Now we probably need a last step: adding labels to each point to give more insight to the figure!

Related

Make a search

0 Followers

Most reacted comment
4 Comment authors
Recent comment authors
Subscribe
Notify of
Guest
Tim

I had a couple of issues getting this code to work, which boiled down to:
1) setting alpha to 1, e.g.:
p + geom_conn_bundle(data = get_con(from = from, to = to), alpha=1, colour=”skyblue”, width=0.9, tension=0.1)

2) changing the name of the second column in the vertices data frame to avoid duplicate element names.
# create a vertices data.frame. One line per object of our hierarchy
vertices = data.frame(
name = unique(c(as.character(hierarchy\$from), as.character(hierarchy\$to))) ,
size= runif(111)
)

Guest
Joel

The last section does not work )-:

Guest
Joel

The last section is unaviable )-:

Guest
Georgette

Hello, I’m trying to understand what the ‘value’ column represents. Instead of taking an adjacency matrix, it seems that the ‘connections’ are composed of two columns of the connections between subgroups (nodes). I have created two columns as such and a third column (value) that has the strength of the connection between nodes (correlation value). However, I see that then another vertices file has to be created that also has a “value” column- is this value different from the other one? Or have I misunderstood and “value” cannot be the strength of connection but represents perhaps a distance from the… Read more »

Guest
jace

I’m having trouble following where “group” comes from in the colour argument for geom_node_point.