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()

API for coders

Text formatting

The many text formatting options include multi-line label wrapping, size, and color.


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

Font size

The font size is controlled by two parameters. These set the font-size for two views, font-size-large (@media min-width: 600px), otherwise font-size. Setting a large font-size may require adjustment of the margin parameter to avoid text-clipping.

Chord(matrix, names, colors="reds", margin=200,
      font_size="20px", font_size_large="30px").show()
PlotAPI - Chord Diagram

Single-colored label

To change the colour of our labels, we can set a HEX colour code to the label_colors parameter.

Chord(matrix, names, label_colors="#B362FF").show()
PlotAPI - Chord Diagram

Multi-coloured labels from a list

To change the colour of our labels, we can set a HEX colour code to the label_colors parameter.

Chord(matrix, names, 
      label_colors=['red','#00ff99','blue','pink','yellow','cyan']).show()
PlotAPI - Chord Diagram

Multi-coloured labels matching chord colours

Chord(matrix, names, 
      label_colors_match=True, curved_labels=True).show()
PlotAPI - Chord Diagram

Text wrapping

Label wrapping is controlled with by the wrap_labels parameter which is True by default.

Let’s use longer entries for names to demonstrate text wrapping.

names = [
    "Exciting Action",
    "Fun Adventure",
    "Hilarious Comedy",
    "Drama",
    "Fantasy",
    "Chilling Thriller"
]
Chord(matrix, names, label_colors_match=True).show()

Let’s demonstrate label wrapping set to disabled.

Chord(matrix, names, label_colors_match=True,
      wrap_labels=False).show()
PlotAPI - Chord Diagram
Previous
Chord