Visualizations Bar Fight
Temporal format
Temporal formats can be used for order values and presentation.
Sample data
Let's import PlotAPI and load our sample data.
from plotapi import BarFight
samples = [
{"order": "2000-01-01", "name": "Sankey", "value": 10},
{"order": "2000-01-01", "name": "Terminus", "value": 10},
{"order": "2000-01-01", "name": "Chord", "value": 40},
{"order": "2000-01-01", "name": "Bar Fight", "value": 90},
{"order": "2000-01-01", "name": "Pie Fight", "value": 70},
{"order": "2000-02-01", "name": "Sankey", "value": 30},
{"order": "2000-02-01", "name": "Terminus", "value": 20},
{"order": "2000-02-01", "name": "Chord", "value": 40},
{"order": "2000-02-01", "name": "Bar Fight", "value": 120},
{"order": "2000-02-01", "name": "Pie Fight", "value": 55},
{"order": "2000-03-01", "name": "Sankey", "value": 35},
{"order": "2000-03-01", "name": "Terminus", "value": 45},
{"order": "2000-03-01", "name": "Chord", "value": 60},
{"order": "2000-03-01", "name": "Bar Fight", "value": 85},
{"order": "2000-03-01", "name": "Pie Fight", "value": 100},
{"order": "2000-04-01", "name": "Sankey", "value": 25},
{"order": "2000-04-01", "name": "Terminus", "value": 60},
{"order": "2000-04-01", "name": "Chord", "value": 90},
{"order": "2000-04-01", "name": "Bar Fight", "value": 50},
{"order": "2000-04-01", "name": "Pie Fight", "value": 105},
{"order": "2000-05-01", "name": "Sankey", "value": 60},
{"order": "2000-05-01", "name": "Terminus", "value": 80},
{"order": "2000-05-01", "name": "Chord", "value": 120},
{"order": "2000-05-01", "name": "Bar Fight", "value": 30},
{"order": "2000-05-01", "name": "Pie Fight", "value": 95},
]
Demonstration
We can see the order
values have the format YYYY-MM-DD
above. We can format the orders with format_current_order=c
.
BarFight(samples, format_current_order="c").show()
The dates must be in the YYYY-MM-DD
format - this means appearing as 2000-04-01
and not 2000-4-1
. If this format isn't maintained then samples will appear out of order.