In my previous post we saw a circular or a chord diagram showing the direction of trade in USA.
Chord diagrams are very interesting to look at and in this case shows the countries that trade with USA i.e. import as well as exports in 2015. The size of chord shows the amount / size of trade with each country. For e.g. USA imports $ 483 billion worth of goods from China and exports $ 116 billion to China.
I came across a new visualization tool flourish which makes creating visualizations very easy. Users can log in flourish using their google account to create their visualizations. The free account allows users to keep their visualizations private. It is possible to create one in R using the circlize package in R. The chord diagram we are generating does not require too much customization and hence we can use flourish in this case. If you require flexibility i would suggest using R.
Analysis of India’s Direction of Trade:
The chord diagram shows that India has a trade deficit with oil exporting countries such as Saudi Arabia, Iraq and Indonesia. India also has a trade deficit with China mostly from importing consumer and electronic goods. On the other hand India has a positive trade balance with USA, UAE and Switzerland.
The chords are interactive and popups provides the reader to see the extent of trade gap i.e. how big is the trade gap as it displays the actual value of trade.
Flourish is a web based tool and does not require any downloads or installation, just a google account to log in.
The data for this visualization was downloaded from Reserve Bank of India (RBI) website. RBI publishes an annual report called Handbook of Statistics on Indian Economy which contains the data for direction of trade. The data is available for download in excel format under the file called “Direction of Foreign Trade- US Dollar”. The reason i have not attached the link to the file is because the links are updated and data may no longer be available under the same link.
For this exercise i have selected only a few countries. If i use all the countries the chord diagrams gets too crowded and it is hard to study the direction of trade. In order to select countries for this diagram i have selected 5 countries where India has most deficit and 5 countries where India does not have trade deficit. The final data file used in this example can be downloaded here.
If you compare the RBI file with my file i have made some changes to the original file. Flourish requires 3 columns from, to and value to generate the chord diagram. The original file has data for imports to India and Exports from India. So we first calculate trade deficit as (Exports – Imports) for each country. Then i select the 5 countries with negative values and 5 countries with positive values. Note that we are going to plot the import and export value , the trade deficit is calculated for selecting our sample.
Now to Flourish:
The hard work is generating the data for chord diagram. Now we can sign in to flourish and click on “New” under visualization heading. This will take you to a page with all the visualizations that are possible using flourish.
We can now scroll to the section that says chord diagram and select directional chords. This will load a default chord diagram which we can use as a template for our data. As shown in the image below, we can click on Data that will open a table where we can import the data.
The image below shows 3 important sections. First on the top left above the table we see a clickable icon”Import your data” that would allow us to import our RBI data. On the right side of the image we see a quick description of the table which shows the required fields. In the bottom is a quick view of the chord diagram.
As soon as we import our csv file flourish will update the chord diagram with new data set. We can now click on preview tab on the top to switch back to the preview mode.
By now we know that data is where we upload the data and preview is where we can make aesthetic changes to the chord diagram. At this point we need to make few edits in the preview tab. We see a few drop downs which will allow us to make edits to our chord diagram. The image below shows a quick view of all the available options to edit chord diagram:
All these options are very self explanatory and the best way to learn is open each drop down and explore what changes we can make to our chord diagram. I have made the following edits to the default view
- Added header and footer to chord diagram
- Set the background colour under the colour drop down
- Under Arcs i have selected the option “make arc colour label the same as arc color”
Readers should see what best suits their needs.
After we have made all the necessary edits we can export the chord diagram in various formats. If you click on “export and publish” flourish will provide you with all the available options.
But if we want to use the chord diagram for a media article, presentation, report or for thesis we can simply download a png version and make further edits using inkscape or adobe illustrator. Flourish also allows a SVG version for those with SVG knowledge.
My aim in this post was to introduce readers to Flourish and chord diagram. I also wanted to show that it is not very difficult to create awesome media quality charts using free online tools like flourish. Since data on Indian economy is digital and free to download i would love to see some visuals that are impactful and tell a very engaging story.
It would be great if you post me links in comments section of this post to visualization you create using flourish.