Skip to content

barracuda.plotting

Matplotlib plots. Every function returns an Axes and does not show, save, or close figures.

Matplotlib plots for BARRACUDA's tidy result tables.

Matplotlib is imported only when a plotting function is called, so simulation and inference users avoid its import-time cost. Every function returns an Axes object and never calls :func:matplotlib.pyplot.show.

Attributes

MODEL_COLOURS module-attribute

MODEL_COLOURS: Final[dict[str, str]] = {'homo': '#5C677D', 'z2p': '#4C78A8', 'dis2p': '#59A14F', 'hetero3': '#E45756', 'homogeneous_history_independent': '#5C677D', 'homogeneous_history_dependent': '#4C78A8', 'heterogeneous_history_independent': '#59A14F', 'heterogeneous_history_dependent': '#E45756'}

BF_THRESHOLDS_LOG10 module-attribute

BF_THRESHOLDS_LOG10: Final[tuple[float, float, float]] = (float(np.log10(3.0)), 1.0, 2.0)

__all__ module-attribute

__all__ = ['BF_THRESHOLDS_LOG10', 'MODEL_COLOURS', 'plot_bayes_factor_scan', 'plot_event_count_distribution', 'plot_model_evidence', 'plot_parameter_recovery', 'plot_posterior_intervals', 'plot_posterior_pair', 'plot_rate_distribution', 'plot_trajectory_state_map']

Functions:

_matplotlib

_matplotlib()

_axes

_axes(ax: Any = None, *, figsize: tuple[float, float] = (7.2, 4.4))

_require_columns

_require_columns(frame: DataFrame, columns: Sequence[str], name: str) -> None

_model_column

_model_column(frame: DataFrame) -> str

_colour

_colour(label: Any, index: int = 0) -> str

plot_event_count_distribution

plot_event_count_distribution(frame: DataFrame, *, condition_column: str = 'condition', normalize: bool = False, ax: Any = None) -> 'Axes'

Plot an empirical count distribution, optionally split by condition.

plot_rate_distribution

plot_rate_distribution(rate_distribution: str, mu_lambda: float, sigma_lambda: float, *, points: int = 320, ax: Any = None) -> 'Axes'

Plot the engaging-cell rate law used by an event-count simulation.

plot_model_evidence

plot_model_evidence(evidence: DataFrame, *, condition: str | None = None, ax: Any = None, title: str | None = None) -> 'Axes'

Plot positive log10 BF(best / model) from any BARRACUDA evidence table.

_scan_value_column

_scan_value_column(frame: DataFrame) -> str

plot_bayes_factor_scan

plot_bayes_factor_scan(scan: DataFrame, *, scenario: str | None = None, model_keys: Sequence[str] | None = None, interval: float = 0.9, value_column: str | None = None, ax: Any = None) -> 'Axes'

Plot median Bayes-factor trajectories and replicate intervals.

Sample sizes are cumulative prefixes within each scenario/replicate, as in the package scan runners. The shaded interval therefore describes between-replicate variation, not independent samples at adjacent sizes.

plot_parameter_recovery

plot_parameter_recovery(recovery: DataFrame, *, parameter: str | None = None, model_key: str | None = None, mean_column: str | None = None, ax: Any = None) -> 'Axes'

Plot posterior means and HDIs against generating truth.

plot_posterior_intervals

plot_posterior_intervals(summary: DataFrame, *, parameter_column: str = 'parameter', mean_column: str = 'mean', lower_column: str = 'hdi_lower', upper_column: str = 'hdi_upper', ax: Any = None) -> 'Axes'

Plot any tidy posterior interval table as horizontal error bars.

plot_trajectory_state_map

plot_trajectory_state_map(frame: DataFrame, *, condition: str | None = None, ax: Any = None) -> 'Axes'

Plot empirical lethal probability at each pre-contact history state.

plot_posterior_pair

plot_posterior_pair(draws: DataFrame, x: str, y: str, *, group: str | None = 'model_key', max_points_per_group: int | None = 5000, seed: int | None = 17, ax: Any = None) -> 'Axes'

Plot paired posterior draws without breaking joint dependence.