Visualizations Chord
Animation
PlotAPI Chord supports animations - both for looping and for nice introductions to your visualisation.
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
Animations can be controlled with the following parameters:
-
animated_loop
will result in an animation that loops forever, this is primarily useful in combination with theto_mp4()
end-point to create a looping video. -
animated_intro
will result in an animation that loops once, and serves as a nice introduction to your visualisation as it loads. -
animated_duration
determines how long a single loop will take.
Let's try both approaches.
Animated loop
Chord(
matrix,
names,
colors="league",
wrap_labels=True,
animated_loop=True,
animated_duration=3000,
).show()
Animated intro
Chord(
matrix,
names,
colors="orange_red",
wrap_labels=True,
animated_intro=True,
animated_duration=3000,
).show()