Plotapi, beautiful by default.

Let plotapi do the heavy lifting – enabling beautiful interactive visualisations with a single line of code (instead of hundreds).

Get Plotapi

Getting started with Plotapi Sankey

Made with Plotapi

You can create beautiful, interactive, and engaging visualisations like this one with Plotapi in any programming language.

Preamble

In [1]:
from plotapi import Sankey

Sankey.set_license("your username", "your license key")

Introduction

Our first Plotapi Sankey Diagram! As we can see, we have set our license details in the preamble with Sankey.set_license().

Dataset

Plotapi Sankey expects a list of dictionary items, these will define the flow between a source and a target.

In [6]:
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},
]

We can add many source's and target's in any arrangement.

Visualisation

Creating our first Sankey Diagram is as easy as calling Plotapi with our one input.

Here we're using .show() which outputs to a Jupyter Notebook cell, however, we may want to output to an HTML file with .to_html() instead. More on the different output methods later!

Be sure to interact with the visualisation to see what the default settings can do!

In [9]:
Sankey(links).show()
Plotapi - Sankey Diagram

Here we can see the default behaviour of Plotapi Chord. This includes:

  • Horizontal node labels at the shallowest and deepest depths of our diagram, with vertical labels in-between.
  • An arrangement of nodes that are left aligned.
  • Text-wrapping, e.g. "The Most Amazing Prize" as seen above.
  • Links labelled with their quantity.
  • Node and Link tooltips.
  • Animations when hovering over a node.

You can do so much more than what's presented in this example, and we'll cover this in later sections. If you want to see the full list of growing features, check out the Plotapi Documentation.

Made with Plotapi

You can create beautiful, interactive, and engaging visualisations like this one with Plotapi in any programming language.

Plotapi, beautiful by default.

Let plotapi do the heavy lifting – enabling beautiful interactive visualisations with a single line of code (instead of hundreds).

Get Plotapi