srvar.plotting

srvar.plotting.plot_crps_by_horizon(forecasts, y_true, *, horizons=None, var=None, ax=None, use_latent=False, theme=None)[source]
Return type:

tuple[Any, Any]

srvar.plotting.plot_forecast_coverage(forecasts, y_true, *, intervals=None, horizons=None, var=None, ax=None, use_latent=False, theme=None)[source]
Return type:

tuple[Any, Any]

srvar.plotting.plot_forecast_fanchart(fc, *, var, bands=(0.1, 0.9), ax=None, use_latent=False, theme=None)[source]

Plot a forecast fan chart from predictive simulations.

Parameters:
  • fc (ForecastResult) – Output from srvar.api.forecast().

  • var (str) – Variable name to plot.

  • bands (tuple[float, float]) – Quantile band (low, high) for the fan.

  • ax (Any | None) – Optional Matplotlib axis.

  • use_latent (bool) – If True and latent draws exist (ELB model), use latent draws instead of floored observed draws.

  • theme (Theme | None) – Optional theme for styling. If None, uses DEFAULT_THEME.

Returns:

Matplotlib figure and axis.

Return type:

(fig, ax)

srvar.plotting.plot_pit_histogram(forecasts, y_true, *, var, horizon, bins=10, ax=None, use_latent=False, theme=None)[source]
Return type:

tuple[Any, Any]

srvar.plotting.plot_shadow_rate(fit, *, var, bands=(0.1, 0.9), ax=None, overlays=None, show_observed=True, theme=None)[source]

Plot observed vs. latent shadow-rate series.

Parameters:
  • fit (FitResult) – Output from srvar.api.fit().

  • var (str) – Variable name to plot.

  • bands (tuple[float, float]) – Quantile band (low, high) for uncertainty visualization when latent draws are available.

  • ax (Any | None) – Optional Matplotlib axis to draw into.

  • overlays (dict[str, Iterable[float]] | None) – Optional additional named series to overlay (e.g., benchmark rates).

  • show_observed (bool) – Whether to plot the observed (censored) series.

  • theme (Theme | None) – Optional theme for styling. If None, uses DEFAULT_THEME.

Returns:

Matplotlib figure and axis.

Return type:

(fig, ax)

srvar.plotting.plot_ssvs_inclusion(fit, *, ax=None, theme=None)[source]

Plot posterior inclusion probabilities for SSVS.

Parameters:
  • fit (FitResult) – Output from srvar.api.fit() with prior.family='ssvs'.

  • ax (Any | None) – Optional Matplotlib axis.

  • theme (Theme | None) – Optional theme for styling. If None, uses DEFAULT_THEME.

Returns:

Matplotlib figure and axis.

Return type:

(fig, ax)

srvar.plotting.plot_trace(draws, *, ax=None, label=None, theme=None)[source]

Plot a simple MCMC trace for a 1D parameter draw sequence.

Parameters:
  • draws (ndarray) – 1D array of MCMC draws.

  • ax (Any | None) – Optional Matplotlib axis.

  • label (str | None) – Optional title for the plot.

  • theme (Theme | None) – Optional theme for styling. If None, uses DEFAULT_THEME.

Returns:

Matplotlib figure and axis.

Return type:

(fig, ax)

srvar.plotting.plot_volatility(fit, *, var, bands=(0.1, 0.9), ax=None, theme=None)[source]

Plot stochastic volatility (posterior std dev) for a given series.

Parameters:
  • fit (FitResult) – Output from srvar.api.fit() with volatility enabled.

  • var (str) – Variable name.

  • bands (tuple[float, float]) – Quantile band (low, high) used to summarize posterior uncertainty.

  • ax (Any | None) – Optional Matplotlib axis.

  • theme (Theme | None) – Optional theme for styling. If None, uses DEFAULT_THEME.

Returns:

Matplotlib figure and axis.

Return type:

(fig, ax)