graphnetz.plotting

Publication-ready matplotlib helpers.

The defaults follow figures guidelines: sans-serif Helvetica/Arial, single-column width 89 mm and double-column 183 mm, thin axes, no top/right spines, restrained categorical palette, vector output at 300 dpi.

graphnetz.plotting.figure(width: str | float = 'single', aspect: float = 1.45, nrows: int = 1, ncols: int = 1, **kwargs: object) tuple[plt.Figure, np.ndarray | plt.Axes][source]

Create a sized figure.

width is either "single", "double" or a float in inches.

graphnetz.plotting.panel_label(ax: matplotlib.pyplot.Axes, text: str, x: float = -0.18, y: float = 1.05) None[source]

Add a bold panel label (a, b, …) to an axis.

graphnetz.plotting.plot_grouped_bars(values: Mapping[str, Mapping[str, float]], errors: Mapping[str, Mapping[str, float]] | None = None, ax: plt.Axes | None = None, title: str | None = None, ylabel: str = 'metric', annotate: bool = True, legend_loc: str = 'outside bottom', legend_ncol: int | None = None) tuple[plt.Figure, plt.Axes][source]

Grouped bar chart from a {group: {series: value}} mapping.

Optional errors of the same shape draws symmetric error bars.

graphnetz.plotting.plot_history(history: Mapping[str, Sequence[float]], ax: plt.Axes | None = None, title: str | None = None, std: Mapping[str, Sequence[float]] | None = None, legend_loc: str = 'best') tuple[plt.Figure, plt.Axes][source]

Plot a training history dict.

loss-keys go on the primary axis; metric-keys on a twin axis with dashed lines. std (optional) provides per-epoch standard deviation rendered as a translucent band.

graphnetz.plotting.save_figure(fig: matplotlib.pyplot.Figure, path: str | Path, formats: Sequence[str] = ('pdf', 'png'), dpi: int = 300) list[Path][source]

Save fig to one path stem in multiple formats; returns the saved paths.

graphnetz.plotting.set_plot_style() None[source]

Apply the rcParams and color cycle.