Visualizations Bar Fight
Node visibility
Let's take a look at how we can change the number of bars that are visible by default.
Sample data
Let's import PlotAPI and load our sample data.
from plotapi import BarFight
samples = [
{"order": 0, "name": "Sankey", "value": 10},
{"order": 0, "name": "Terminus", "value": 12},
{"order": 0, "name": "Chord", "value": 8},
{"order": 0, "name": "Bar Fight", "value": 9},
{"order": 0, "name": "Pie Fight", "value": 12},
{"order": 1, "name": "Sankey", "value": 18},
{"order": 1, "name": "Terminus", "value": 24},
{"order": 1, "name": "Chord", "value": 22},
{"order": 1, "name": "Bar Fight", "value": 14},
{"order": 1, "name": "Pie Fight", "value": 17},
{"order": 2, "name": "Sankey", "value": 24},
{"order": 2, "name": "Terminus", "value": 40},
{"order": 2, "name": "Chord", "value": 32},
{"order": 2, "name": "Bar Fight", "value": 19},
{"order": 2, "name": "Pie Fight", "value": 42},
{"order": 3, "name": "Sankey", "value": 32},
{"order": 3, "name": "Terminus", "value": 62},
{"order": 3, "name": "Chord", "value": 40},
{"order": 3, "name": "Bar Fight", "value": 25},
{"order": 3, "name": "Pie Fight", "value": 64},
{"order": 4, "name": "Sankey", "value": 32},
{"order": 4, "name": "Terminus", "value": 75},
{"order": 4, "name": "Chord", "value": 55},
{"order": 4, "name": "Bar Fight", "value": 45},
{"order": 4, "name": "Pie Fight", "value": 120},
]
Demonstration
By default PlotAPI displays up to 10
nodes in the animation. This can be controlled with the top_n
parameter.
Let's demonstrate setting this to 2
.
BarFight(samples, top_n=2).show()