Visualizations Bar Fight
Layout properties
The title, width, height, margin, position, background color, and border can be changed with these layout properties.
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": 150},
{"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": 160},
{"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": 180},
{"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": 200},
{"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": 220},
]
Demonstration
We can modify the width
, height
, and margin
of our diagram.
The margin
is a dict of float
values that is applied as a margin of that size.
The background_color
and border
can be changed too.
To include a diagram title, we can pass the desired string into the title
parameter.
By default a Sankey diagram is centered, but this can be disabled with center=False
.
With layout properties
BarFight(
samples,
colors="turbo",
title="PlotAPI BarFight with a Title",
width=800,
height=400,
margin={"top":10,"right":10,"bottom":10,"left":200},
center=False,
background_color="#1E1E3F",
border="#a599e9 dashed",
).show()
Without layout properties
BarFight(samples).show()