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

Changing the Colours and Icons


In [1]:
from plotapi import LineFight

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


Let's take a look at how we can change the colours and icons for nodes in our Line Fight diagram.

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


Plotapi Line 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": 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.
  • name the name of the item, and the text that appears on the element.
  • value the value of the element at the associated point in time.

Next, we'll start customising the elements, or nodes, that will represent our data over time. Plotapi Line Fight expects a list of dictionary items to configure each node.

In [3]:
nodes = [
        "name": "Sankey",
        "color": "#ffd166", 
        "icon": ""
        "name": "Terminus",
        "color": "#06d6a0", 
        "icon": ""
        "name": "Chord",
        "color": "#118ab2", 
        "icon": ""
        "name": "Bar Fight",
        "color": "#073b4c", 
        "icon": ""
        "name": "Pie Fight",
        "color": "#ef476f", 
        "icon": ""

We can see that each dictionary item has three properties:

  • name, the name of the item, which corresponds to names specified in the samples definitions above.
  • color, the desired colour of the elements (CSS colour e.g. "#073b4c" or "red").
  • icon, the location of the image to use for the icon.


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 [4]:
Plotapi - Line 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