85  The Sankey Diagram

Sankey diagrams are a fantastic alternative to the same observations, different variables pie chart. Sometimes referred to as alluvial plots, these plots allow us to view flow of an item across many categories. Figure 85.1 depicts the three pie charts from ?fig-Bayerpiecharts.

Figure 85.1: A Sankey diagram showing the flow between three different categories. The lines between categories are colored according to the first column.

Let’s take a look at another example of a Sankey diagram where the connectors encode a new variable. The figure below depicts 13 346 recorded terrorist attacks from 1998 - 2015. For each attack we can see which country it occurred in, which group claimed responsibility and what weapons were used. The color tells us the groups ideology, either ethnic, political or religious.

Sankey diagram.

Since this plot has a time component, we would also be interested to see how terrorist attacks have changed over time, i.e. map time onto the x axis. Plotting an individual line for each group is inefficient, since there would be many colors. Plus, I want to know the group’s ideology, which means I have to do more work.

An line plot of the terrorism data set. The overlapping line colors and line types make it difficult to follow trends.

A bubble chart as an alternative to a line plot.