"Individual items can be tracked through the flow of a Sankey diagram" - really?

At this site we find the enticing statement
“Individual items can be tracked through the flow of a Sankey diagram”:

And we are given the beautiful example of a plot by Alishoberi which indeed IS able to do this.


However the R script given here:


fails to reproduce that diagram in R.

What is the secret sauce here that permits tracking (at the individual observation level) of trajectories across nodes? Is it all about how the data are structured to start with (e.g. case by case vs. collapsed observations)? Or perhaps there are unique identifiers that need to be assigned to each trace in the plot post hoc?

Any insights on this extremely useful “path tracking” feature appreciated!


Individual tracking is done with the help of the link_label argument of the Sankey link attribute.

By having the same link label text on multiple flows, these multiple flows are considered only “one” when hovering on one of them. The link label text acts sort of as a unique ID for hovering.

I have achieved to implement individual tracking with Python, but I’m not sure about R …

Hope it helps a bit.