A python notebook to help make interactive chord chart easily

Chord chart is poplar in visualization since it looks fancy and complex. It can show the relationship among several objects by chords. Making an interactive chord chart can allow readers to track the numerical info of each chord. This notebook may help you make one in a very short time.

After import some useful libraries, we read the csv into dataframe. The format of the csv is shown in cell 2. This is trimmed from a TED dataset. Each row show the main topics mentioned in one TED talk show. Our goal is to find the top 10 topics, and visualize the relationship among the topics.

Firstly, do some trimming. Split the string into words and strip the not useful punctuation. Then put all the topics in a list.

Make a dictionary to count and record the occurrence number of each topics, and find the top 10 topics easily.

Since we only cares about the top 10 topics, we create a 10*10 numpy matrix here. Then use double for loops to check whether whether these two topics occur in one record and generate a relationship matrix.

Turn the numpy matrix to list and check again.

Then use the Chord function to generate a chord chart.

You can find out.html in your directory. It is actually implemented by D3, and you can do some improvement base on it.

You can download the notebook, csv file and html file by this link:

https://drive.google.com/drive/folders/1W4QO1NCUBcpfETFJcJXkzQIrN4axvaIM?usp=sharing

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Having Fun Plotting Data Squirrels in R

Introduction to Support Vector Machine

Building autopilots for engineering systems using AI

Big Data: The Frontier of the 2000s

Learning Day 5: Pytorch data creation, slicing and shaping

Data Science and consilience

8 Metrics to Measure Classification Performance

Further Dives into the Depths of Data; Nodes and Linked Lists

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aiden

Aiden

More from Medium

The Basic Principles Of There Was a problem sending the command to the program

How an extreme sport changed my life.

Wagtail blog part#2

My file Server(Armour infosec)