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 Bar Fight

Event mode

Event information can be displayed using different modes, these include paused, running, and interactive.


Sample data

Let's import PlotAPI and load our sample data.

from plotapi import BarFight

samples = [
    {"order": 0, "name": "Sankey", "value": 10},
    {"order": 0, "name": "Terminus", "value": 12},
    {"order": 0, "name": "Chord", "value": 8},
    {"order": 0, "name": "Bar Fight", "value": 9},
    {"order": 0, "name": "Pie Fight", "value": 12},

    {"order": 1, "name": "Sankey", "value": 18},
    {"order": 1, "name": "Terminus", "value": 24},
    {"order": 1, "name": "Chord", "value": 22},
    {"order": 1, "name": "Bar Fight", "value": 14},
    {"order": 1, "name": "Pie Fight", "value": 17},

    {"order": 2, "name": "Sankey", "value": 24},
    {"order": 2, "name": "Terminus", "value": 40},
    {"order": 2, "name": "Chord", "value": 32},
    {"order": 2, "name": "Bar Fight", "value": 19},
    {"order": 2, "name": "Pie Fight", "value": 42},

    {"order": 3, "name": "Sankey", "value": 32},
    {"order": 3, "name": "Terminus", "value": 62},
    {"order": 3, "name": "Chord", "value": 40},
    {"order": 3, "name": "Bar Fight", "value": 25},
    {"order": 3, "name": "Pie Fight", "value": 64},

    {"order": 4, "name": "Sankey", "value": 32},
    {"order": 4, "name": "Terminus", "value": 75},
    {"order": 4, "name": "Chord", "value": 55},
    {"order": 4, "name": "Bar Fight", "value": 45},
    {"order": 4, "name": "Pie Fight", "value": 120},
]
events = [
    {
        "order": 0,
        "event": '<p>Event information content can be <b>formatted with HTML</b>!</p><p>You can even include CSS - the <a href ="https://plotapi.com">power</a> of both are available.</p>'
    },
    {
        "order": 1,
        "event": '<b>Something Special</b><br><img src="https://datacrayon.com/datasets/pokemon_img/150.png"><p>Something special happened here, probably!</p>'
    },
    {
        "order": 4,
        "event": '<p>By specifying a <b>duration</b>, an event can be displayed for longer than the default value - much like this one!</p>',
    }
]

Demonstration

Default event mode

Without any additional configuration, the default event mode will pause the visualisation for the event duration.

This duration is specified either per-event using the events structure above, or globally using the event_duration parameter as seen below.

BarFight(samples,
         events=events,
         event_duration=7500).show()
PlotAPI - Bar Fight Diagram

Running event mode

By specifying event_pause=False, we can keep the visualisation running during the duration of the event content.

In this mode, the event duration is treated as a maximum duration, such that any subsequent events will interrupt the previous one.

BarFight(samples,
         events=events,
         event_pause=False).show()
PlotAPI - Bar Fight Diagram

Interactive Event Mode

By specifying auto_proceed=False, we can pause the visualisation and require user interaction for it to continue, i.e. clicking the continue button.

BarFight(samples,
         events=events,
         auto_proceed=False).show()
Previous
Bar Fight