Visualizations Chord
Ticks
PlotAPI Chord supports displaying and formatting ticks around the diagram.
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
The visibility and total number of ticks can be controlled with the ticks
parameter. Setting it to a number greater than
The ticks_color
parameter will set the color of the tick lines.
The ticks_font_size
parameter will set the size of the tick labels.
The ticks_font_color
parameter will set the color of the tick labels.
The ticks_label_format
parameter will string format the tick labels.
Ticks enabled
Chord(matrix, names, colors="cividis", ticks=45).show()
Ticks styling and formatting
Blue tick lines, size 14 and purple tick labels.
Chord(
matrix,
names,
colors="viridis",
ticks_color="blue",
ticks_font_size=14,
ticks_font_color="purple",
ticks=30,
).show()
90 ticks, black tick lines, size 7 and black tick labels.
Chord(
matrix,
names,
colors="set2",
ticks_color="black",
ticks_font_size=8,
ticks_font_color="black",
ticks=90,
).show()
360 ticks, transparent tick labels.
Chord(
matrix,
names,
colors="turbo",
ticks_font_color="transparent",
ticks=360,
).show()