Engaging plots, made easy.

Easily turn your data into engaging visualizations. Powerful API for coders. Powerful app for everyone.

main.py
notebook.ipynb
main.rs
from plotapi import Chord

Chord(matrix, names).show()

Visualizations Chord

Pulled out arcs

PlotAPI Chord supports pulling out arcs as a way to highlight or group elements.


Sample data

Let's import PlotAPI and load our sample data.

from plotapi import Chord

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"]

Demonstration

Pulling arcs can be controlled with the pull parameter. It expects a list of floats, one for each arc, indicating how far out to pull.

Let's pull out the Adventure arc by 50px. It's the second item in our names list above, so we'll adjust the second position.

Chord(matrix, names, pull=[0, 50, 0, 0, 0, 0]).show()

Let's pull out Fantasy by 50px too.

Chord(matrix, names, pull=[0, 50, 0, 0, 50, 0]).show()
PlotAPI - Chord Diagram

How about everything pulled out to different positions?

Chord(matrix, names, pull=[0, 20, 40, 60, 80, 100]).show()
PlotAPI - Chord Diagram

Highlighting groups

Let's highlight Thriller and Action as if they are related somehow.

Chord(
    matrix,
    names,
    colors=["red", "blue", "blue", "blue", "blue", "red"],
    pull=[20, 0, 0, 0, 0, 20],
).show()
PlotAPI - Chord Diagram

Pushing instead of pulling

To push instead of pull, you can use negative numbers.

Chord(
    matrix,
    names,
    pull=[0, 0, 0, 0, -30, 0],
).show()
PlotAPI - Chord Diagram
Previous
Chord