How to create a chord diagram on Python in 3 screenshots
2 min readJul 11, 2021
- visualize weighted relationships between several entities.
- The data are arranged radially around a circle with the relationships between the data points typically drawn as arcs connecting the data.
For more visualization and analytics
Screenshot 1 — That your data:
import pandas as pd
import holoviews as hv
df = pd.DataFrame({
'Soccer': [0, 1, 4, 2, 3, 2],
'Football': [1, 0, 3, 2, 4, 2],
'Baseball': [1, 3, 4, 5, 5, 5],
'Basketball': [5, 1, 2, 0, 4, 3],
'Hockey': [2, 1, 5, 2, 3, 0],
'VolleyBall': [1, 5, 5, 4, 4, 0]
}, index=['Soccer', 'Football', 'Baseball', 'Basketball', 'Hockey', 'VolleyBall'])
df.head()
Screenshot 2 — Flatten your data:
import pandas as pd
import holoviews as hv
from holoviews import opts, dim
hv.extension('matplotlib')
hv.output(size=300)
Screenshot 3 — That your chord diagram:
For more visualization and analytics
https://drivenn.io/