Visualizations Sankey
Link background color
Until we mouseover a Sankey link, what we actually see is the background color. By default, this background colour is set to be the same as the link foreground color, as defined by the `colors` parameter, which by default is `"gradient"`.
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
We can set the link background colour by passing a HEX colour code or string alias into the link_background_color
parameter. Let's try setting the link background colour to grey
.
Sankey(links, link_background_color="grey").show()