Temporal plots¶
This page documents 5 public symbols. Each entry includes its purpose, import path, full API docstring, and the maintained example that exercises it.
plot_temporal_coefficient_slices¶
Plot coefficient maps at selected observed time slices.
| Property | Value |
|---|---|
| Type | function |
| Import | from pygwrx.plotting import plot_temporal_coefficient_slices |
| Signature | plot_temporal_coefficient_slices(model, feature, *, times: 'Optional[Sequence[object]]' = None, max_cols: 'int' = 3, shared_scale: 'bool' = True, theme: 'str' = 'default', figsize: 'Optional[Tuple[float, float]]' = None, cmap: 'Optional[str]' = None, title: 'Optional[str]' = None) |
| Maintained example | examples/plotting/05_temporal_and_weights.py |
plot_temporal_coefficient_slices ¶
plot_temporal_coefficient_slices(
model,
feature,
*,
times: Optional[Sequence[object]] = None,
max_cols: int = 3,
shared_scale: bool = True,
theme: str = "default",
figsize: Optional[Tuple[float, float]] = None,
cmap: Optional[str] = None,
title: Optional[str] = None
)
Plot coefficient maps at selected observed time slices.
Source code in src/pygwrx/plotting/temporal.py
plot_mgtwr_scales¶
Plot variable-specific spatial bandwidths and temporal scale parameters.
| Property | Value |
|---|---|
| Type | function |
| Import | from pygwrx.plotting import plot_mgtwr_scales |
| Signature | plot_mgtwr_scales(model, *, theme: 'str' = 'default', figsize: 'Optional[Tuple[float, float]]' = None, title: 'str' = 'MGTWR variable-specific spatiotemporal scales') |
| Maintained example | examples/plotting/05_temporal_and_weights.py |
plot_mgtwr_scales ¶
plot_mgtwr_scales(
model,
*,
theme: str = "default",
figsize: Optional[Tuple[float, float]] = None,
title: str = "MGTWR variable-specific spatiotemporal scales"
)
Plot variable-specific spatial bandwidths and temporal scale parameters.
Source code in src/pygwrx/plotting/temporal.py
plot_temporal_trajectory¶
Plot a coefficient trajectory aggregated by time or followed by location.
| Property | Value |
|---|---|
| Type | function |
| Import | from pygwrx.plotting import plot_temporal_trajectory |
| Signature | plot_temporal_trajectory(model, feature, *, location=None, reducer: 'str' = 'mean', theme: 'str' = 'default', ax: 'Optional[plt.Axes]' = None, figsize: 'Optional[Tuple[float, float]]' = None, title: 'Optional[str]' = None) |
| Maintained example | examples/plotting/05_temporal_and_weights.py |
plot_temporal_trajectory ¶
plot_temporal_trajectory(
model,
feature,
*,
location=None,
reducer: str = "mean",
theme: str = "default",
ax: Optional[Axes] = None,
figsize: Optional[Tuple[float, float]] = None,
title: Optional[str] = None
)
Plot a coefficient trajectory aggregated by time or followed by location.
Source code in src/pygwrx/plotting/temporal.py
plot_temporal_residuals¶
Plot fitted residuals against time with a zero reference line.
| Property | Value |
|---|---|
| Type | function |
| Import | from pygwrx.plotting import plot_temporal_residuals |
| Signature | plot_temporal_residuals(model, *, theme: 'str' = 'default', ax: 'Optional[plt.Axes]' = None, figsize: 'Optional[Tuple[float, float]]' = None, title: 'Optional[str]' = None) |
| Maintained example | examples/plotting/05_temporal_and_weights.py |
plot_temporal_residuals ¶
plot_temporal_residuals(
model,
*,
theme: str = "default",
ax: Optional[Axes] = None,
figsize: Optional[Tuple[float, float]] = None,
title: Optional[str] = None
)
Plot fitted residuals against time with a zero reference line.
Source code in src/pygwrx/plotting/temporal.py
plot_temporal_bandwidths¶
Plot spatial/temporal scales for GTWR, MGTWR, STWR, or SGTWR.
| Property | Value |
|---|---|
| Type | function |
| Import | from pygwrx.plotting import plot_temporal_bandwidths |
| Signature | plot_temporal_bandwidths(model, *, theme: 'str' = 'default', ax: 'Optional[plt.Axes]' = None, figsize: 'Optional[Tuple[float, float]]' = None, title: 'Optional[str]' = None) |
| Maintained example | examples/plotting/05_temporal_and_weights.py |
plot_temporal_bandwidths ¶
plot_temporal_bandwidths(
model,
*,
theme: str = "default",
ax: Optional[Axes] = None,
figsize: Optional[Tuple[float, float]] = None,
title: Optional[str] = None
)
Plot spatial/temporal scales for GTWR, MGTWR, STWR, or SGTWR.
Source code in src/pygwrx/plotting/temporal.py
Runnable examples used on this page¶
examples/plotting/05_temporal_and_weights.py
# SPDX-FileCopyrightText: 2026 Jinghao Hu
# SPDX-License-Identifier: MIT
"""All temporal, multiscale, weight decomposition, and selection-history plots."""
# Allow this script to run directly from any working directory.
import sys
from pathlib import Path
_PROJECT_ROOT = Path(__file__).resolve().parents[2]
_EXAMPLES_ROOT = _PROJECT_ROOT / "examples"
_SRC_ROOT = _PROJECT_ROOT / "src"
for _path in (_SRC_ROOT, _EXAMPLES_ROOT):
if str(_path) not in sys.path:
sys.path.insert(0, str(_path))
import matplotlib
matplotlib.use("Agg", force=True)
from _common import save_plot
from _models import temporal_models
from pygwrx.plotting import (
plot_mgtwr_scales,
plot_selection_history,
plot_temporal_bandwidths,
plot_temporal_coefficient_slices,
plot_temporal_residuals,
plot_temporal_trajectory,
plot_weight_decomposition,
plot_weight_profiles,
)
X, y, coords, times, gtwr, mgtwr, sgtwr, sgwr, stwr, search_model = temporal_models()
plots = {
"temporal_slices.png": plot_temporal_coefficient_slices(gtwr, "x1"),
"temporal_trajectory.png": plot_temporal_trajectory(gtwr, "x1"),
"temporal_residuals.png": plot_temporal_residuals(gtwr),
"temporal_bandwidths.png": plot_temporal_bandwidths(sgtwr),
"mgtwr_scales.png": plot_mgtwr_scales(mgtwr),
"sgwr_decomposition.png": plot_weight_decomposition(sgwr, 0),
"sgwr_profiles.png": plot_weight_profiles(sgwr, 0, sort_by="combined"),
"stwr_decomposition.png": plot_weight_decomposition(stwr, 0),
"sgtwr_decomposition.png": plot_weight_decomposition(sgtwr, 0),
"selection_history.png": plot_selection_history(search_model),
}
for name, result in plots.items():
print(save_plot(result, name))