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

Visualizations Sankey

Node sorting

The nodes in a PlotAPI Sankey diagram can be sorted (e.g. alphabetically) within their columns.


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

The nodes can be sorted with the node_sort parameter. The options available node_sort="alpha" for alphabetical sorting, or an empty string/None for default sorting.

Below is a demonstration of the alphabatical, alpha, sort.

Sankey(
    links,
    node_sort="alpha"
).show()
Sankey(
    links,
).show_png()
Notebook PNG image
Previous
Sankey