Visualizations
Chord
Everything you need to create beautiful, engaging, and interactive Chord visualizations.
Introduction
Chord diagrams, also known as radial network diagrams, are a form of data visualisation that have become quite popular partly because of how colorful and eye-catching they can be. They are most useful when trying to convey relationships between different entities.
In a chord diagram, entities are arranged radially as arcs, which you could also refer to as the nodes. The relationships between these entities are visualised by chords that connect them, which you could also refer to as the links.
The video below is a good introduction on how to create a chord diagram from concept to code.
Importing PlotAPI Chord
Let's import Chord
from the PlotAPI package.
from plotapi import Chord
We've already activated our license with the license activation instructions.
Data structure
PlotAPI Chord expects a list of names (list[str]
) and a co-occurence matrix (list[list[float]]
) as input.
matrix = [
[0, 5, 6, 4, 7, 4],
[5, 0, 5, 4, 6, 5],
[6, 5, 0, 4, 5, 5],
[4, 4, 4, 0, 5, 5],
[7, 6, 5, 5, 0, 4],
[4, 5, 5, 5, 4, 0],
]
names = ["Action", "Adventure", "Comedy", "Drama", "Fantasy", "Thriller"]
Action | Adventure | Comedy | Drama | Fantasy | Thriller | |
---|---|---|---|---|---|---|
Action | 0 | 5 | 6 | 4 | 7 | 4 |
Adventure | 5 | 0 | 5 | 4 | 6 | 5 |
Comedy | 6 | 5 | 0 | 4 | 5 | 5 |
Drama | 4 | 4 | 4 | 0 | 5 | 5 |
Fantasy | 7 | 6 | 5 | 5 | 0 | 4 |
Thriller | 4 | 5 | 5 | 5 | 4 | 0 |
Default visualization
Creating our first Chord Diagram is as easy as calling PlotAPI with our two inputs.
Be sure to interact with the visualisation to see what the default settings can do!
Chord(matrix, names).show()