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

Line Fight

Everything you need to create beautiful, engaging, and interactive Line Chart Race visualizations.


Importing PlotAPI Line Fight

Let's import LineFight from the PlotAPI package.

from plotapi import LineFight

We've already activated our license with the license activation instructions.

Data structure

PlotAPI Line Fight expects at minimum a list of dictionary items, these will define the value of our lines over time.

samples = [
    {"order": 0, "name": "Sankey", "value": 10},
    {"order": 0, "name": "Terminus", "value": 10},
    {"order": 0, "name": "Chord", "value": 40},
    {"order": 0, "name": "Bar Fight", "value": 90},
    {"order": 0, "name": "Pie Fight", "value": 70},

    {"order": 1, "name": "Sankey", "value": 30},
    {"order": 1, "name": "Terminus", "value": 20},
    {"order": 1, "name": "Chord", "value": 40},
    {"order": 1, "name": "Bar Fight", "value": 120},
    {"order": 1, "name": "Pie Fight", "value": 55},

    {"order": 2, "name": "Sankey", "value": 35},
    {"order": 2, "name": "Terminus", "value": 45},
    {"order": 2, "name": "Chord", "value": 60},
    {"order": 2, "name": "Bar Fight", "value": 85},
    {"order": 2, "name": "Pie Fight", "value": 100},

    {"order": 3, "name": "Sankey", "value": 25},
    {"order": 3, "name": "Terminus", "value": 60},
    {"order": 3, "name": "Chord", "value": 90},
    {"order": 3, "name": "Bar Fight", "value": 50},
    {"order": 3, "name": "Pie Fight", "value": 105},

    {"order": 4, "name": "Sankey", "value": 60},
    {"order": 4, "name": "Terminus", "value": 80},
    {"order": 4, "name": "Chord", "value": 120},
    {"order": 4, "name": "Bar Fight", "value": 30},
    {"order": 4, "name": "Pie Fight", "value": 95},
]

We can see that each dictionary item has three properties:

  • order which determines with time period this item belongs to. This should be numerical, but can be formatted e.g. as dates (YYYY.MM.DD).
  • name the name of the item, and the text that appears on the lines.
  • value the value of the lines at the associated point in time.

Default visualization

Creating our first Line Fight Diagram is as easy as calling PlotAPI with our one input.

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

LineFight(samples).show()
Previous
Bar Fight