Get the Books
Enjoying these notebooks and want to support the work? Check out the practical books on Data Science, Visualisation, and Evolutionary Algorithms.
Get the booksGetting started with Plotapi Pareto Front
Support this work
You can support this work by getting the ebooks. This notebook will always be available for free in its online format.
Preamble¶
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 nondominated 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 biobjective solutions over time.
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.
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!
ParetoFront(samples, events=events, title="Bench Press",
objv_1_unit=" kg", objv_2_unit=" reps",
x_label="Weight(kg)", y_label="Reps").show()
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.
Support this work
You can support this work by getting the ebooks. This notebook will always be available for free in its online format.
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