Visualizations Terminus
Pipe bundling
Let's take a look at the bundling parameter. This will group together the input, giving the impression that they are entering through the same pipe.
Sample data
Let's import PlotAPI and load our sample data.
from plotapi import Terminus
links = [
{"source":"England", "target":"Germany", "value": 1000},
{"source":"England", "target":"France", "value": 3000},
{"source":"England", "target":"Spain", "value": 5000},
{"source":"England", "target":"Italy", "value": 4000},
{"source":"England", "target":"Japan", "value": 800},
{"source":"Ireland", "target":"Germany", "value": 3500},
{"source":"Ireland", "target":"France", "value": 3750},
{"source":"Ireland", "target":"Spain", "value": 1750},
{"source":"Ireland", "target":"Italy", "value": 5000},
{"source":"Ireland", "target":"Japan", "value": 400},
]
Demonstration
To enable bundled pipes, all we need to do is set bundled
to True
.
Here we're using .show()
which outputs to a Jupyter Notebook cell, however, we may want to output to a HTML file with .to_html()
instead. More on the different output methods later.
Terminus(links, pipe_color="#000000", pipe_opacity=0.1,
bundled=True).show()
Terminus(links, pipe_color="#000000", pipe_opacity=0.1,
pipe_alignment="middle", bundled=True).show_png()