Similar idea: Funnel Charts
Sankey Chart: Beginner Step-by-Step Guide
Solution1. Build Sankey Charts Based on Transformed Data
Use one excel worksheet. Data transformation was completed in excel.
This viz shows the change of ranks for each state from 2012 to 2013.
Solution2. Build Sankey Charts By Joining Two Worksheets
Use two excel worksheets. Data transformation was completed in Tableau directly, so the visualization can be updated with new data without redoing the charts.
This time, we create calculated fields for “sigmoid function” and “curve” in Tableau, instead of having them as variables in excel before import.
Solution3. Use Polygons to Simply the Viz
- Create a "Top Step 1" set: right-click on "Step 1" pill / create a set and sort it using Top / By Field / Top / Top N Step 1 (parameter) / Size (indicator) / Sum
Here size indicator is the variable named Visites
The calculated field was named “Group Step 1” in author’s workbook:
- Create an "Agg Step 1" dimension: this should be IF [Top Step 1] THEN [Step 1] ELSE 'x Other' END
Group Step 2:
IF ISNULL([Step 2]) THEN 'x Sortie de site' ELSEIF [Top Step 2] THEN [Step 2] ELSE 'x Other' END
Group Step 3:
IF ISNULL([Step 3]) THEN 'x Sortie de Site' ELSEIF [Top Step 3] THEN [Step 3] ELSE 'x Other' END
More about Sankey Charts
Decision Trees & Flow Diagrams:
Make Sankey Charts with Alteryx
How to unhide headers: Right click the pill next to “Columns” or “Rows”, and select “Show header”.
How to create position1 & 2 in STATA: (suppose var1 is the variable on the left side, and var2 is the variable on the right side)
sort var1 var2
gen position1 = _n
sort var2 var1 position1
gen position2 = _n
* You need to add “position1” in the second sort command to get smooth lines. (If you don’t, you will get the right intervals, but the lines in each interval would be messy-style crossing each other.)
How to reduce white space:
For stacked bar charts (which will be placed to the left and right of the curve), simply use the size shelf to enlarge the size, and edit the y axis to have a fixed range from 0 to the largest number.
For the curve chart, set x axis to fixed -6 to 6, and y axis to fixed range.
Given that it’s so complicated to create sankey charts with Tableau, it might be a good idea to consider alternative tools.
A tool to develop sankey diagrams directly: Fineo
This is a blog with all kinds of sankey diagrams: http://www.sankey-diagrams.com/
There is also a page about the softwares: sankey diagram software