Visualizations
Pareto Front
Everything you need to create beautiful, engaging, and interactive Pareto Front visualizations.
Importing PlotAPI Pareto Front
Let's import ParetoFront
from the PlotAPI package.
from plotapi import ParetoFront
We've already activated our license with the license activation instructions.
Data structure
PlotAPI Pareto Front expects at minimum a list
of dictionary
items, these will define bi-objective 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!"
}
]
Default visualization
Creating our first Pareto Front Diagram is as easy as calling PlotAPI with our one input.
Be sure to interact with the visualisation to see what the default settings can do!
ParetoFront(samples, events=events, title="Barbell Bench Press",
objv_1_unit=" kg", objv_2_unit=" reps",
x_label="Weight(kg)", y_label="Reps").show()