Visualizations Terminus
Animation
The Terminus animation can be modified to improve the presentation of our diagram, giving us control over a pixel's journey duration, how many pixels are dispatched at once, and the delay before the animation begins.
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 animation.
-
delay
, how long to wait before the animation begins -
pixel_journey_duration
, how long each pixel should take from the beginning to end terminus. -
pixel_batch_size
, how many pixels will start their journey at each interval.
Higher pixel_journey_duration
and pixel_batch_size
values will result in worse performance. We may need to tune them if we want to go to an extreme.
Let's try a fast-moving Terminus diagram.
Terminus(links, delay=3000, pixel_journey_duration=1500, pixel_batch_size=10).show()