Circular Chord Diagram in Python

2.4k Views Asked by At

enter image description here

I would like to create a circular chord diagram

I found this link of chord diagram in plotly v3, but in version4 this seams to be not available.

Same for chord diagram in bokeh the new version does not contain a way to create a chord diagram.

How to create a chord diagram with Python?

2

There are 2 best solutions below

1
On BEST ANSWER

You can use Chord of holoviews

import pandas as pd
import holoviews as hv
from holoviews import opts, dim
from bokeh.sampledata.les_mis import data

hv.extension('bokeh')
hv.output(size=200)
links = pd.DataFrame(data['links'])
print(links.head(3))
hv.Chord(links)
2
On

With the D3Blocks library you can create Chord chart in d3js.

# Install
pip install d3blocks

# Load d3blocks
from d3blocks import D3Blocks

# Initialize
d3 = D3Blocks()

# Load example data
df = d3.import_example('energy')

# Plot
d3.chord(df)

# Or specify the output path
d3.chord(df, filepath='c:/temp/chord.html')

enter image description here