Visualizations Bar Fight
Node colors
The color scheme can be set to one of many beautiful presets, or even a customized by supplying a list of colors (HEX, RGB, etc.).
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
To specify node colors, we can set the colors
parameter to one of the following:
- A list of color strings, e.g.
["#264653","#2a9d8f","#e9c46a","#f4a261","#e76f51"]
. If there are fewer colors than there are categories, PlotAPI will loop round the colors. - The name of a color scheme from one of the many beautuful presets.
The default color scheme is "rainbow". Let's try a few different color schemes.
BarFight(samples, colors="monsters").show()
BarFight(
samples, colors=["#B8D0EB", "cyan", "rgb(111,45,189)", "indigo", "violet"]
).show_png()
Color presets
Take advantage of one of our color presets by passing in its name to the color
parameter. Choose from one of the following:
['monsters', 'league', 'movies', 'category10', 'accent', 'dark2', 'paired', 'pastel1', 'pastel2', 'set1', 'set2', 'set3', 'tableau10', 'rainbow', 'sinebow', 'yellow_red', 'yellow_brown', 'yellow_green', 'yellow_blue', 'red_purple', 'purple_red', 'purple_blue', 'orange_red', 'green_blue', 'blue_purple', 'blue_green', 'cubehelix', 'cool', 'warm', 'cividis', 'plasma', 'magma', 'inferno', 'viridis', 'turbo', 'brown_green', 'purple_green', 'pink_green', 'red_blue', 'red_grey', 'red_yellow_blue', 'red_yellow_green', 'spectral', 'blues', 'greens', 'greys', 'oranges', 'purples', 'reds']