stochkin.plotting¶
Publication-quality plotting utilities.
Plotting utilities for stochkin.
Every public function in this module applies the stochkin publication
style (set_publication_style()) before drawing,
so that all output figures are publication-ready by default.
The style mirrors the Matplotlib rcParams used in the FES_2D.ipynb analysis notebook (Arial font, inward ticks, white background, 300 dpi, single-column figure width).
- stochkin.plotting.plot_results(times, positions, velocities, energies, bins=50)[source]¶
Basic diagnostic plots for a 2D Langevin trajectory.
Four panels: trajectory, energy vs time, position histogram, energy histogram.
- stochkin.plotting.plot_mfpt_matrix(mfpt_network_results, log10=False, cmap='magma', figsize=(3.3, 2.8), title='MFPT matrix τ(i→j)')[source]¶
Plot MFPT(i→j) as a heatmap.
- stochkin.plotting.plot_fp_solution_vs_boltzmann(fp_result, beta=1.0, log=True, cmap='viridis', figsize=None)[source]¶
Compare FP steady-state with Boltzmann distribution.
- stochkin.plotting.plot_basin_network(basin_network, levels=40, fes_cmap='viridis', basin_cmap='tab20', alpha_basins=0.35, show_minima=True, annotate_ids=True, figsize=(3.3, 2.8))[source]¶
Plot the FES with overlaid basin partition and minima.
- Parameters:
basin_network (BasinNetwork) – As returned by
detect_basins_for_mfpt.levels (int) – Number of contour levels.
fes_cmap (str) – Colormaps.
basin_cmap (str) – Colormaps.
alpha_basins (float) – Basin overlay transparency.
show_minima (bool) – Show minimum markers / basin-id labels.
annotate_ids (bool) – Show minimum markers / basin-id labels.
figsize (tuple) – Figure size.
- stochkin.plotting.plot_central_well_barrier_ring(a=1.0, b=1.0, A=0.5, sigma=0.5, r_max=2.0, n_points=400, grid_size=200)[source]¶
Plot the radial profile + 2D landscape of the ring-barrier potential.
- stochkin.plotting.plot_2d_fes(data_path, *, save_path=None, levels=10, fes_max=None, delta=90, reweight=False, invert=False, xlim=None, ylim=None, auto_zoom=True, zoom_pad=0.08, cmap_name='rainbow', swap_xy=True, show_cbar=True, cbar_label='FES (kJ/mol)', xlabel=None, ylabel=None, pathways=None, pathway_style=None, pathway_markers=False, pathway_every=1, pathway_labels=None, figsize=(4, 3), ax=None)[source]¶
Plot a PLUMED-format 2D FES as a filled contour.
This is a cleaned-up version of the
plot_2d_contourf_MAXhelper from the FES_2D.ipynb notebook, with publication styling applied automatically.- Parameters:
data_path (str or Path) – Path to a PLUMED
sum_hills2D FES file.save_path (str or Path, optional) – If given, save the figure to this path at 300 dpi.
levels (int) – Number of contour levels.
fes_max (float, optional) – Fixed colour-scale maximum (kJ/mol). Also used as the masking threshold if delta is not explicitly set.
delta (float) – Percentile threshold for masking (default 90).
reweight (bool) – Subtract the minimum from the FES.
swap_xy (bool) – Swap x/y axes (matches the notebook convention CN(Cl) vs CN(O)).
pathways (list, optional) – MFEP overlay data (arrays or file paths).
ax (matplotlib Axes, optional) – Draw onto an existing Axes instead of creating a new figure.
- Returns:
fig, ax (if *ax was None*)
ax (if an existing *ax was passed*)
- stochkin.plotting.draw_barrier_arrows(ax, x, y_top, y0, *, y_bottom=None, label=True, label_fmt='{:.1f}', label_side='right', label_dx=0.05, label_dy=0.0, label_x_overrides=None, label_y_overrides=None, y_override_mode='abs', arrowprops=None, text_kwargs=None)[source]¶
Draw double-headed barrier-height arrows on an Axes.
Ported from the
draw_barrier_arrowshelper in FES_2D.ipynb.- Parameters:
ax (matplotlib Axes)
x (float or array) – Horizontal position(s) of the arrow(s).
y_top (float or array) – Top of each arrow (barrier peak FES value).
y0 (float) – Default baseline (bottom) for the arrows.
y_bottom (float or array, optional) – Per-arrow bottom override.
label (bool) – Annotate the barrier height ΔF.
label_side (
'right'or'left') – Side on which to place the label text.