chaotic_pfc.plotting.figures

figures.py

Publication-quality SVG figures with LaTeX-style labels.

All text uses matplotlib’s mathtext engine (no external LaTeX needed). Figures are saved as .svg by default for vector-quality output.

Functions

plot_attractor(X, Y[, title, xlabel, ...])

Plot a phase-space portrait of a 2-D trajectory.

plot_comm_grid(n, m, s, r, m_hat, omega, ...)

4×2 grid: left = time domain, right = PSD.

plot_sensitivity(n, X1, X2[, save_path, lang])

Overlay two Hénon trajectories to illustrate sensitivity to ICs.

setup_rc()

Configure matplotlib for publication-quality LaTeX-style SVG output.

Classes

PlotGridOptions([time_window, suptitle, ...])

Optional styling parameters for plot_comm_grid().

chaotic_pfc.plotting.figures.setup_rc()[source]

Configure matplotlib for publication-quality LaTeX-style SVG output.

Uses STIX fonts (the standard for scientific publishing, very close to Computer Modern) and converts all text to vector paths so that SVGs render identically on any system without requiring font installation.

chaotic_pfc.plotting.figures.plot_attractor(X, Y, title='', xlabel='$x_1[n]$', ylabel='$x_2[n]$', save_path=None)[source]

Plot a phase-space portrait of a 2-D trajectory.

Parameters:
  • X (ndarray[tuple[Any, ...], dtype[_ScalarT]]) – State-variable trajectories, same length.

  • Y (ndarray[tuple[Any, ...], dtype[_ScalarT]]) – State-variable trajectories, same length.

  • title (str) – Optional figure title. If empty, no title is drawn.

  • xlabel (str) – Axis labels. Defaults use LaTeX-style math for x_1 and x_2.

  • ylabel (str) – Axis labels. Defaults use LaTeX-style math for x_1 and x_2.

  • save_path (str | None) – If given, the figure is written to this path. The extension selects the format (.svg, .png, etc.).

Returns:

The matplotlib Figure object. Returned so callers can inspect or further annotate it before showing / closing.

Return type:

Figure

chaotic_pfc.plotting.figures.plot_sensitivity(n, X1, X2, save_path=None, lang='pt')[source]

Overlay two Hénon trajectories to illustrate sensitivity to ICs.

Plots two state trajectories that start from infinitesimally different initial conditions, making visually obvious how they diverge exponentially — the classic demonstration of chaos.

Parameters:
  • n (ndarray[tuple[Any, ...], dtype[_ScalarT]]) – Sample index axis, shape (N,).

  • X1 (ndarray[tuple[Any, ...], dtype[_ScalarT]]) – Two state trajectories evaluated on n. Typically differing only by x0_2 = x0_1 + 1e-4.

  • X2 (ndarray[tuple[Any, ...], dtype[_ScalarT]]) – Two state trajectories evaluated on n. Typically differing only by x0_2 = x0_1 + 1e-4.

  • save_path (str | None) – If given, the figure is written to this path.

  • lang (str) – Language code for the figure title ("pt" or "en").

Returns:

The matplotlib Figure object.

Return type:

Figure

class chaotic_pfc.plotting.figures.PlotGridOptions(time_window=<factory>, suptitle='', y_lim_msg=(-1.5, 1.5), y_lim_sig=(-2.5, 2.5), y_lim_mhat=None, h_channel=None, save_path=None)[source]

Bases: object

Optional styling parameters for plot_comm_grid().

All fields have sensible defaults; only override what you need.

Parameters:
time_window: slice
suptitle: str = ''
y_lim_msg: tuple[float, float] = (-1.5, 1.5)
y_lim_sig: tuple[float, float] = (-2.5, 2.5)
y_lim_mhat: tuple[float, float] | None = None
h_channel: ndarray[tuple[Any, ...], dtype[_ScalarT]] | None = None
save_path: str | None = None
chaotic_pfc.plotting.figures.plot_comm_grid(n, m, s, r, m_hat, omega, psd_m, psd_s, psd_r, psd_mhat, *, opts=None, time_window=slice(0, 300, None), suptitle='', y_lim_msg=(-1.5, 1.5), y_lim_sig=(-2.5, 2.5), y_lim_mhat=None, h_channel=None, save_path=None, lang='pt')[source]

4×2 grid: left = time domain, right = PSD. Rows: m[n], s[n], r[n], m̂[n]. If h_channel is provided, its frequency response is overlaid on PSD_s.

The opts dataclass overrides individual keyword arguments when both are provided.

Parameters:
Return type:

Figure