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

Node aligment

PlotAPI Sankey supports different layouts using the specification of node alignment.


Sample data

Let’s import PlotAPI and load our sample data.

from plotapi import Sankey

links = [
    {"source":"Group A", "target":"Rank 1", "value": 1000},
    {"source":"Group B", "target":"Rank 1", "value": 300},
    {"source":"Group B", "target":"Rank 2", "value": 600},
    {"source":"Group B", "target":"Rank 3", "value": 400},
    {"source":"Rank 1", "target":"Club A", "value": 700},
    {"source":"Rank 1", "target":"Club B", "value": 400},
    {"source":"Rank 1", "target":"Club C", "value": 200},
    {"source":"Rank 2", "target":"Club B", "value": 200},
    {"source":"Rank 2", "target":"Club C", "value": 400},
    {"source":"Rank 3", "target":"Withdrawn", "value": 400},
    {"source":"Club A", "target":"The Most Amazing Prize", "value": 500},
]

Demonstration

We can change how our nodes are arranged using the node_alignment parameter. It supports the following settings: left, right, justify, and center. Let’s demonstrate these below.

Right alignment

Sankey(links, colors="monsters", link_numbers=False, 
       node_alignment="right").show()

Justified alignment

Sankey(links, colors="monsters", link_numbers=False, 
       node_alignment="justify").show_png()
Notebook PNG image

Center alignment

Sankey(links, colors="monsters", link_numbers=False, 
       node_alignment="center").show_png()
Notebook PNG image

Left alignment

Sankey(links, colors="monsters", link_numbers=False, 
       node_alignment="left").show_png()