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

Event Information Modes


In [1]:
from plotapi import PieFight

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


Let's take a look at changing how the event information is displayed during a Pie Fight diagram.

Plotapi Pie Fight is a beautiful and feature rich take on the popular Pie Chart Race. As we can see, we have set our license details in the preamble with PieFight.set_license().


Plotapi Pie Fight expects at minimum a list of dictionary items, these will define the value of our segments over time.

In [2]:
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": 38},
    {"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},

Next, we'll start specifying event content to appear at certain points during our visualisation. Plotapi Pie Fight expects a list of dictionary items to configure each event.

In [3]:
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 ="">power</a> of both are available.</p>'
        "order": 1,
        "event": '<b>Something Special</b><br><img src=""><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>',


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!

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.

In [4]:
Plotapi - Pie 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.

In [5]:
Plotapi - Pie 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.

In [6]:
Plotapi - Pie Fight Diagram

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 in any programming language with Plotapi.

Get the Books

Enjoying these notebooks and want more on the subject? Check out the practical books on Data Science, Visualisation, and Evolutionary Algorithms.

Get the books