Skip to content

Visualization

Visualization helpers (matplotlib is optional).

FigureSpec dataclass

Figure sizing standard for papers/docs.

apply_axes_style(ax)

Small, consistent cosmetics that match journal histograms.

configure_notebook_display(*, dpi=300, use_retina=True)

Improve inline figure clarity in notebooks.

journal_style(extra_rc=None)

Context manager for consistent styling without global side-effects.

new_figure(spec=None)

Create a styled figure/axes pair.

paper_context(style=None)

Backwards-compatible alias for journal_style().

paper_figspec(column='single', aspect=0.62)

Typical journal widths: - single column ~ 3.25-3.5 in - double column ~ 6.5-7.0 in

plot_bias_variance_tradeoff(results, *, title=None, column='single', aspect=0.62, ax=None)

Plot bias-variance tradeoff for estimators with known truth.

plot_effective_sample_size(weights, *, by_time=False, title=None, column='single', aspect=0.62, ax=None)

Plot effective sample size diagnostics.

plot_estimator_comparison(df, truth=None, *, xlabel='Estimated value', title=None, column='double', aspect=0.62, ax=None)

Plot estimator comparison with confidence intervals.

plot_importance_weights(weights, *, bins=40, logy=True, xlabel='$\\hat{w}$', ylabel='Count', title=None, column='single', aspect=0.62, ax=None)

Plot importance weight distribution.

plot_overlap_diagnostics(target_action_probs, behavior_action_probs, mask=None, threshold=0.001, *, bins=40, xlabel='$\\hat{\\nu}$', ylabel='Count', title=None, column='double', aspect=0.55, ax=None)

Plot overlap diagnostics from target/behavior propensities.

plot_sensitivity_curve(bounds_df, *, xlabel='Sensitivity parameter $\\gamma$', ylabel='Policy value', title=None, column='double', aspect=0.62, ax=None)

Plot sensitivity curve with lower/upper bounds.

save_figure(fig, outpath, *, dpi=500)

Save both PDF (vector) and PNG (high DPI) with the same stem. Returns the generated file paths.

set_style(style=None)

Apply the journal rcParams globally (legacy helper).