Sankey plots in Stata using Python

Sankey graphs in Stata


The sankey Stata package provides a simple way of producing Sankey graphs, using the plotly library in Python. You can find the plotly homepage here.

An example:

. use https://www.mjcrowther.co.uk/data/sankey_eg1
. sankey start stop freq, colors(3 "green" 6 "red") linkcolor(lightgreen)

The produced plot can be viewed here.

$~$


sankey in Stata

The current version of sankey in Stata, which requires Stata version 16, can be installed by typing:

net install sankey, from(https://www.mjcrowther.co.uk/code/sankey)

and then run adoupdate as normal to pick up any updates.

$~$


Related

comments powered by Disqus