visualization¶
Matplotlib-based plot functions. Requires the [plot] extra
(pip install "fSTG-Toolkit[plot]").
Plotting the spatio-temporal graphs.
- class fstg_toolkit.visualization.DynamicPlot(graph: SpatioTemporalGraph)[source]¶
Bases:
objectA dynamic plot that contains both temporal and spatial plot with interactivity.
- graph: SpatioTemporalGraph¶
- class fstg_toolkit.visualization.DynamicTimeCursor(axe: Axes, func: Callable[[int], None], all_coord: dict[int, tuple[int, int]], rev_coord: dict[tuple[int, int], int], graph: SpatioTemporalGraph, **lineprops)[source]¶
Bases:
CursorA dynamic cursor for time points.
- fstg_toolkit.visualization.multipartite_plot(g: SpatioTemporalGraph, ax: Axes = None) None[source]¶
Draw a multipartite plot for the spatio-temporal graph.
- Parameters:
g (SpatioTemporalGraph) – The spatio-temporal graph.
ax (matplotlib.axes.Axes, optional) – The axes on which to plot. If not set, the current axes will be used.
- fstg_toolkit.visualization.spatial_plot(graph: SpatioTemporalGraph, t: float, ax: Axes = None, edges_bending: float = 3) None[source]¶
Draw a spatial plot for spatio-temporal graph.
- Parameters:
graph (SpatioTemporalGraph) – The graph to plot.
t (float) – The instant to plot in the graph.
ax (matplotlib.axes.Axes, optional) – The axes on which to plot. If not set, the current axes will be used.
edges_bending (float, optional) – Controls the bending of the edges. Close to 0 means full bending, close to infinity means no bending (default is 3).
- fstg_toolkit.visualization.temporal_plot(graph: SpatioTemporalGraph, ax: Axes = None) tuple[dict[int, tuple[int, int]], dict[tuple[int, int], int]][source]¶
Draw a temporal plot for a spatio-temporal graph.
- Parameters:
graph (SpatioTemporalGraph) – The spatio-temporal graph.
ax (matplotlib.axes.Axes, optional) – The axes on which to plot. If not set, the current axes will be used.
- Returns:
The first dictionary maps node identifiers to their coordinates (time, height). The second dictionary maps coordinates (time, height) to node identifiers.
- Return type:
tuple[dict[int, tuple[int, int]], dict[tuple[int, int], int]]