Advertisements

Direction of Trade – Chord Diagram

Introduction :

In my previous post we saw a circular or a chord diagram showing the direction of trade in USA.

chord diagram showing USA direction of trade in 2015

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.

Tools:

Flourish is a web based tool and does not require any downloads or installation, just a google account to log in.

Data :

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.

Data Transformation:

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.

Image showing steps for importing data in flourish.

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.

Export:

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.

Since i wanted to keep the visual interactive i used “HTML” option. This will publish the visualization and also provide a javascript link which can be used in wordpress blog. If you have a free or an individual account the HTML option will not work, as far as i know.

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.

Conclusion:

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.

Advertisements

3 thoughts on “Direction of Trade – Chord Diagram

Add yours

  1. Hi Atmajit, great post.
    So as I see it, chord is an improved variation of a pie chart. Pie charts are typically used to depict data like market shares. So is a chord chart also restricted in terms of its usability?

    Thanks,
    Dipti SD

    1. Thanks !!!
      Yes .but it also shows the direction or flow which is not captured in a pie chart. This chord diagram only shows countries that trade with India but one can create a chord diagram where all countries are trading with one another .

Leave a Reply

WordPress.com.

Up ↑

%d bloggers like this: