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 Drama by 30px
too.
Chord(matrix, names, pull=[0, 50, 0, 30, 0, 0]).show()
How about everything pulled out to different positions?
Chord(matrix, names, pull=[0, 20, 40, 60, 80, 100]).show()
Highlighting groups
Let's highlight Thriller and Action as if they are somehow related.
Chord(
matrix,
names,
colors=["red", "blue", "blue", "blue", "blue", "red"],
pull=[20, 0, 0, 0, 0, 20],
).show()
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()