Friday, July 21, 2017

Interactive Trade Flows Chord Diagram (with R)

Chord Diagram is becoming more and more popular in offering an elegant way to capture the complexity of big data, and more so if you can make them "user-driven", i.e. interactive. This post suggests a few tips to do it.

 

After one full day tinkering with Javascripts I was able to produce a very nice interactive plot using the 2013 East Asian intra-regional export flows data provided by one of my fellow PhD students at UWA (Son Nguyen) and the code in the developing R package "chorddiag". I got great help from Son in publishing this plot also.
Note that different from the one-way diagram in my previous post, here the chords are bi-directional, and their colors match those countries with lower bilateral export values, which are also at the smaller ends of these chords. That is, each chord represents a trade deficit for the colored countries. Not the best arrangement I'd say, since it would feel more natural to have the chord colors matched with countries with larger export (to give more of a "flowing" feel?), as shown in a very similar plot (for Australian trade data only) featured in a recent blog by World Bank's Siddhesh Kaushik. For more prominent Javascript developers, there is a blog showing how to create a trade diagram directly with D3 here

No comments:

Post a Comment

Please leave your comment here.