Visualizations Chord
Popup layout and format
The popup supports many customizations, including the text format, width, and disabling it entirely.
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
Popup width
We can modify the popup width with the popup_width
parameter.
Chord(matrix, names, colors="set3", popup_width=100).show()
Disabling the popup
We can disable the popup with the popup_enabled
parameter.
Chord(matrix, names, popup_enabled=False).show()
Popup text format
We can change the noun, verb, and conjunction used in the popup text such that it is relevant for our visualisation. We can also remove them entirely and display names only.
The default looks like this:
An example modification looks like this:
We can modify the popup text template with the conjunction
, verb
, and noun
parameters.
Chord(matrix, names, colors="turbo",
conjunction="&", verb="appear together in", noun="cases").show()
Showing names only
We can show only the names in the popup with the popup_names_only
parameter.
Chord(matrix, names, colors="cool",
popup_names_only=True).show()