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 Pareto Front

Preamble

In [1]:
from plotapi import ParetoFront

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

Introduction

Our first Plotapi Pareto Front Diagram!

Plotapi Pareto Front is a beautiful and feature rich take on non-dominated sorting over time. As we can see, we have set our license details in the preamble with ParetoFront.set_license().

Dataset

Plotapi Pareto Front expects at minimum a list of dictionary items, these will define bi-objective solutions over time.

In [2]:
samples = [
    {'order': 20200101, 'objv_1': 40, 'objv_2': 12},   
    {'order': 20200101, 'objv_1': 40, 'objv_2': 12},   
    {'order': 20200101, 'objv_1': 40, 'objv_2': 12},   

    {'order': 20200104, 'objv_1': 40, 'objv_2': 12},   
    {'order': 20200104, 'objv_1': 40, 'objv_2': 12},   
    {'order': 20200104, 'objv_1': 40, 'objv_2': 14},   

    {'order': 20200109, 'objv_1': 40, 'objv_2': 12},   
    {'order': 20200109, 'objv_1': 45, 'objv_2': 12},   
    {'order': 20200109, 'objv_1': 45, 'objv_2': 10},   

    {'order': 20200112, 'objv_1': 50, 'objv_2': 12},   
    {'order': 20200112, 'objv_1': 50, 'objv_2': 11},   
    {'order': 20200112, 'objv_1': 50, 'objv_2': 10},   

    {'order': 20200115, 'objv_1': 50, 'objv_2': 12},   
    {'order': 20200115, 'objv_1': 50, 'objv_2': 12},   
    {'order': 20200115, 'objv_1': 50, 'objv_2': 12},   

    {'order': 20200115, 'objv_1': 50, 'objv_2': 12},   
    {'order': 20200115, 'objv_1': 50, 'objv_2': 12},   
    {'order': 20200115, 'objv_1': 50, 'objv_2': 12},   

    {'order': 20200120, 'objv_1': 60, 'objv_2': 8},   
    {'order': 20200120, 'objv_1': 60, 'objv_2': 8},   
    {'order': 20200120, 'objv_1': 60, 'objv_2': 8},   

    {'order': 20200123, 'objv_1': 60, 'objv_2': 8},   
    {'order': 20200123, 'objv_1': 60, 'objv_2': 8},   
    {'order': 20200123, 'objv_1': 60, 'objv_2': 8},   

    {'order': 20200123, 'objv_1': 80, 'objv_2': 3},  

    {'order': 20200123, 'objv_1': 30, 'objv_2': 20},  

    {'order': 20200125, 'objv_1': 30, 'objv_2': 20},  
    {'order': 20200125, 'objv_1': 10, 'objv_2': 20}, 

    {'order': 20200129, 'objv_1': 120, 'objv_2': 50},  
    {'order': 20200129, 'objv_1': 50, 'objv_2': 120},   
    {'order': 20200129, 'objv_1': 50, 'objv_2': 120},   
    {'order': 20200129, 'objv_1': 50, 'objv_2': 120},    

    {'order': 20200130, 'objv_1': 100, 'objv_2': 100},      
]

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.
  • objv_1 the first objective value, e.g. "weight".
  • objv_2 the second objective value, e.g. "reps".

We can also populate the events structure to present event text at specific times.

In [3]:
events = [
    {
        "order": 20200101,
        "event": "My first ever gym visit!"
    },
    {
        "order": 20200109,
        "event": "I went a little heavier today!"
    },
    {
        "order": 20200120,
        "event": "Three solid sets of 60 kg!"
    },
    {
        "order": 20200129,
        "event": "Broke some records today!"
    }
]

Visualisation

Creating our first Pareto Front 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 [11]:
ParetoFront(samples, events=events, title="Bench Press",
            objv_1_unit=" kg", objv_2_unit=" reps",
            x_label="Weight(kg)", y_label="Reps").show()
Plotapi - ParetoFront Diagram

Here we can see the default behaviour of Plotapi Pareto Front.

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