Skip to content

Plotting

plot_process_graph

plot_process_graph(
    graph: "TimeSeriesGraph",
    *,
    var_names: Sequence[str] | None = None,
    show_surrogate: bool = True,
    surrogate_name: str = "C",
    figsize: tuple[float, float] = (8.0, 6.0),
    save_path: str | None = None,
    fig_ax: tuple["Figure", "Axes"] | None = None,
    **tigramite_kwargs,
) -> tuple["Figure", "Axes"]

Plot the aggregate process graph: one node per variable.

Parameters:

Name Type Description Default
graph 'TimeSeriesGraph'

The :class:TimeSeriesGraph to render.

required
var_names Sequence[str] | None

Optional list of length graph.n_vars. Defaults to ["X0", "X1", ...]. The surrogate (if shown) is appended automatically.

None
show_surrogate bool

If True (default) and the graph has at least one changing module, draw an extra node C with arrows C -> X_i to each changing module.

True
surrogate_name str

Label for the surrogate node. Default "C".

'C'
figsize tuple[float, float]

Matplotlib figsize. Ignored if fig_ax is provided.

(8.0, 6.0)
save_path str | None

If given, save the figure to this path with bbox_inches="tight" at 150 dpi. The figure is also returned so the caller can do more.

None
fig_ax tuple['Figure', 'Axes'] | None

(fig, ax) to draw into. If None, a new figure is created.

None
**tigramite_kwargs

Forwarded to tigramite.plotting.plot_graph. Useful examples: arrow_linewidth=4, label_fontsize=12, node_size=0.4.

{}

Returns:

Type Description
tuple[Figure, Axes]

plot_time_series_graph

plot_time_series_graph(
    graph: "TimeSeriesGraph",
    *,
    var_names: Sequence[str] | None = None,
    show_surrogate: bool = True,
    surrogate_name: str = "C",
    surrogate_position: str = "top",
    figsize: tuple[float, float] = (10.0, 5.0),
    save_path: str | None = None,
    fig_ax: tuple["Figure", "Axes"] | None = None,
    highlight_changing: bool = True,
    **tigramite_kwargs,
) -> tuple["Figure", "Axes"]

Plot the time-unrolled causal graph.

One node per (variable, time-step); lagged edges go between different time-steps, contemporaneous edges within the same one.

Parameters:

Name Type Description Default
graph 'TimeSeriesGraph'

The :class:TimeSeriesGraph to render.

required
var_names Sequence[str] | None

Optional list of length graph.n_vars. Defaults to ["X0", "X1", ...].

None
show_surrogate bool

If True (default) and the graph has at least one changing module, include the surrogate C as an additional row with contemporaneous arrows C(t) -> X_i(t) to each changing module at every time-step. The surrogate's earlier-lag nodes are drawn for visual consistency but have no incoming or outgoing lagged edges.

True
surrogate_name str

Label for the surrogate row. Default "C".

'C'
surrogate_position str

"top" (default) or "bottom". Determines the surrogate row's vertical position relative to the data variables.

'top'
figsize tuple[float, float]

Matplotlib figsize. Ignored if fig_ax is provided.

(10.0, 5.0)
save_path str | None

If given, save the figure to this path with bbox_inches="tight" at 150 dpi.

None
fig_ax tuple['Figure', 'Axes'] | None

(fig, ax) to draw into. If None, a new figure is created.

None
highlight_changing bool

If True, color changing-module nodes differently from stationary ones (uses tigramite's special_nodes mechanism). Useful in addition to the explicit C -> X_i arrows because it makes the changing modules visually obvious at a glance.

True
**tigramite_kwargs

Forwarded to tigramite.plotting.plot_time_series_graph. Note that the order argument is set automatically based on surrogate_position; passing it explicitly will raise.

{}

Returns:

Type Description
tuple[Figure, Axes]