Visualizations Sankey
Node styling
The nodes in a PlotAPI Sankey diagram can be styled with many different parameters.
Sample data
Let's import PlotAPI and load our sample data.
from plotapi import Sankey
links = [
{"source":"Group A", "target":"Rank 1", "value": 1000},
{"source":"Group B", "target":"Rank 1", "value": 300},
{"source":"Group B", "target":"Rank 2", "value": 600},
{"source":"Group B", "target":"Rank 3", "value": 400},
{"source":"Rank 1", "target":"Club A", "value": 700},
{"source":"Rank 1", "target":"Club B", "value": 400},
{"source":"Rank 1", "target":"Club C", "value": 200},
{"source":"Rank 2", "target":"Club B", "value": 200},
{"source":"Rank 2", "target":"Club C", "value": 400},
{"source":"Rank 3", "target":"Withdrawn", "value": 400},
{"source":"Club A", "target":"The Most Amazing Prize", "value": 500},
]
Demonstration
The nodes can be customised with the following parameters:
-
node_width
- the thickness of the node. -
node_padding
- the padding between each node. -
node_opacity
- the opacity of the node colour. -
node_darken_factor
- how much darker the node colour appears (between and including and ). -
node_border_width
- the thickness of the node border. -
node_border_color
- the colour of the node border.
Sankey(
links,
node_width=40,
node_padding=40,
node_opacity=0.75,
node_darken_factor=1,
node_border_width=10,
node_border_color="#f8f8f8",
).show()