5/13/2019
Sankey Diagrams: Why I Used the Sigmoid Perform and Why You Most likely Shouldn’t
https://www.dataplusscience.com/RecreationinTableau.html
https://www.dataplusscience.com/RecreationinTableau2.html
https://www.dataplusscience.com/RedesignEnergyBill.html
https://www.dataplusscience.com/FinanceSankey.html
https://www.dataplusscience.com/SankeyinTableau82.html
(11/2014) – utilizing Polygons
https://community.tableau.com/thread/154623
https://www.dataplusscience.com/SankeyPolygon.html
https://www.theinformationlab.co.uk/2015/03/04/sankey-charts-in-tableau/
http://vizdiff.blogspot.com/2016/12/creating-sigmoid-with-2-rows-of-data.html
http://vizdiff.blogspot.com/2016/12/creating-sankey-chart-made-bit-easier.html
http://www.datablick.com/blog/2018/1/12/upgrade-your-tableau-sankey-diagram
http://www.kenflerlage.com/2018/04/sankey-template.html
https://appsfortableau.com/extensions/create-sankey-diagrams-in-tableau/
https://www.kenflerlage.com/2019/04/more-sankey-templates.html
The unique chart that I recreated was actually a slopegraph that had curvy S-shaped strains, not a Sankey diagram. I used the Sigmoid operate to create these strains, which labored actually, rather well for this. Nevertheless, the redesign of my Energy Bill and the Finance Sankey are usually not slopegraphs. They’re Sankey diagrams (or extra precisely, alluvial diagrams). I used the identical operate, the sigmoid operate, to generate these strains. And almost everybody that adopted, creating all these further strategies and templates, has leveraged the sigmoid operate.
So what’s the issue? The difficulty is the form of the road within the Sankey diagrams. When utilizing the sigmoid operate, the circulate diagrams begin out exhibiting the scale appropriately, however as they curve, the operate narrows the road.
This was one thing I seen early on, and it was even pointed out on this Sankey website early on after I first revealed my Power Redesign. Again then, I did experiment with different capabilities. I can not find my early workbooks to see what capabilities I experimented with, however I do know I attempted an inverse tangent operate and some others. In the long run, I caught with the Sigmoid operate and the remainder is historical past.
Nevertheless, in January 2018, Chris DeMartini revealed a weblog put up Upgrading Your Sankey Diagram. In Chris’s visualization, he permits the consumer to swap capabilities to see the circulate plotted in numerous methods. That is actually wonderful work and it clearly reveals the variations within the numerous capabilities.
I actually just like the Sigmoid operate for slopegraphs (what I known as Sankey-Type Slopegraphs, that are simply slopegraphs with the S-shaped strains). Nevertheless, the SIN operate works so significantly better for the Sankey diagrams. SINE is a built-in operate in Tableau, SIN(), and I’d guess that extra persons are accustomed to a sine wave than a Sigmoid operate. So how a lot distinction does it actually make? On the Sankey diagrams it is actually noticeable.
Under is an instance from Ken Flerlage’s Sankey Template here. This is a wonderful template and makes constructing Sankey diagrams in Tableau very simple. Nevertheless, discover the curve on the sigmoid operate. The center a part of the curve is lower than half the thickness of the beginning and finish of the curve. Examine that to the Linear or Sine operate.
If I might return in time, I’d have used the SIN operate because the default for the Sankeys as an alternative of the Sigmoid operate. Whereas it is not excellent, it appears to be like significantly better and it’s fairly simple to implement as a result of it is a built-in operate in Tableau. Sadly, the genie is out of the bottle and there at the moment are 5 years of weblog posts and visualizations which were constructed on this system. So for that, I’m sorry. In an effort to appropriate this for future work in Tableau (and different platforms which have adopted this system), I provide this answer.
First, for the Tableau customers, here is an updated template based on Ken Flerlage’s template and here is Ken’s Excel data template for the multi level sankey. You’ll discover that I’ve modified the values of T. As an alternative of going from -6 to +6, they now go from -1.5 to +1.5 (roughly ½ of pie). You should use the dropdown field on this instance to see the variations within the curves.
When creating your personal visualizations, the method is mainly the identical and can apply to polygon Sankeys, information densification Sankeys, and so forth. Nevertheless, as an alternative of making T values from -6 to +6 in .25 increments, merely create them from -1.5 to +1.5 in .075 increments to get the 49 factors. Why 49 factors? Once I used the Sigmoid operate, this gave the impression to be quantity to create a pleasant easy line, with out including a whole lot of factors. Be happy to experiment, however 49 gave the impression to be quantity.
Unique Technique and Formulation:
T values vary from -6 to +6 in .25 increments.
The Sigmoid operate is utilized to T. The result’s 49 factors starting from 0 to 1, which is what we wish.
Sigmoid Perform: 1/(1+EXP(1)^-[T])
New Technique and Formulation:
T values vary from -1.5 to +1.5 in .0625 increments.
The SIN operate is utilized to T. Nevertheless, if we merely take the SIN([T]) with that vary, then it is going to return 49 values starting from -1 to +1. To remodel the vary, we are going to add +1 to maneuver the vary from 0 to 2 after which divide that by 2. It will give us the specified vary of 0 to 1.
SIN Perform: (sin([T])+1)/2
I’ve gone again to my unique Sankey weblog posts that reference the sigmoid operate and I’ve up to date them to level to this weblog put up. For these of you who’ve written related Sankey weblog posts, I’d encourage you to do the identical. In case you are within the math that’s used to attract the strains extra precisely, see this post by Sam Calisch on github.
In the long run, I’m glad I used to be in a position to present such a helpful method to the group and it’s superb to see the entire issues which were constructed on high of it. I hope this up to date method shall be simpler to implement and supply extra constant circulate in future Sankey diagrams.
A giant due to Ken Flerlage for creating this tremendous helpful Sankey template and Chris DeMartini for implementing the totally different easing capabilities. The revised template beneath places this all collectively in a single workbook.