Visualizations Terminus
Pipe styling
The Terminus pipes can be modified to improve the presentation of the diagram, giving control over the spacing and slope positions.
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
There are many opportunities to customise the Terminus pipes.
-
slope_start
, to change the point at which the pipe starts transitioning from itssource
(or ) position to itstarget
(or ) position. Whether it's or depends on whether it's avertical
Terminus diagram or not. This value must be a float between or equal to and . -
slope_end
, similar to the above, but for when the sope ends. -
target_spacing_ratio
, to specify how much of the arrangement should be whitespace versus how much should be taken up by pipe thickness. This value must be a float between or equal to and .
Let's try a few combinations.
Terminus(links, pipe_color="#000000", pipe_opacity=0.1, show_stats=False,
slope_start=0.1, slope_end=0.9).show()
Terminus(links, pipe_color="#000000", pipe_opacity=0.1, show_stats=False,
slope_start=0.45, slope_end=0.55).show_png()
Terminus(links, pipe_color="#000000", pipe_opacity=0.1, show_stats=False,
pipe_spacing_ratio=0.8).show_png()