plots.plot_scenario_comparison
plots.plot_scenario_comparison(
event_log_a,
event_log_b,
first_event,
second_event,
*,
what='mean',
ci_level=0.95,
match='first',
warm_up=0,
label_a='A',
label_b='B',
highlight_bands=None,
**col_kwargs,
)Bar chart comparing a duration statistic between two scenarios.
Turns vidigi.analysis.compare_replication_values into a two-bar chart with CI error bars, and a title stating whether the two intervals overlap and the Welch’s-t p-value - the “highlight differences” view of two scenarios’ event-duration metrics, the counterpart to plot_replication_analysis for comparing between scenarios rather than tracking stability within one.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| event_log_a | pandas.DataFrame | Long-format event logs, one per scenario, e.g. from TrialLogger.to_dataframe(). |
required |
| event_log_b | pandas.DataFrame | Long-format event logs, one per scenario, e.g. from TrialLogger.to_dataframe(). |
required |
| first_event | str | The two events to pair - see vidigi.analysis.event_durations. |
required |
| second_event | str | The two events to pair - see vidigi.analysis.event_durations. |
required |
| what | str | The per-replication statistic to compute. See vidigi.analysis.replication_means. |
"mean" |
| ci_level | float | Confidence level for each scenario’s interval and for the significance test. | 0.95 |
| match | (first, last, occurrence) | How repeated occurrences of the two events are paired. | "first" |
| warm_up | float | Pairings whose first_time is before warm_up are excluded. |
0 |
| label_a | str | Names for each scenario, used as bar labels. | "A", "B" |
| label_b | str | Names for each scenario, used as bar labels. | "A", "B" |
| highlight_bands | list of dict | Shaded threshold zones drawn behind the chart - see plot_duration_distribution’s parameter of the same name for the dict shape. |
None |
| **col_kwargs | dict | Column-name keyword arguments forwarded to vidigi.analysis.event_durations, e.g. run_col_name=. |
{} |
Returns
| Name | Type | Description |
|---|---|---|
| plotly.graph_objects.Figure |
Raises
| Name | Type | Description |
|---|---|---|
| ValueError | If no complete pairs are found in any run of either scenario, or a highlight_bands entry has neither lower nor upper set, or lower >= upper. |
|
| ImportError | If scipy is not installed - see vidigi.analysis.mean_confidence_interval. |
See Also
vidigi.analysis.compare_replication_values : The underlying implementation. plot_replication_analysis : Tracks one scenario’s stability across replications.
Examples
>>> plot_scenario_comparison(baseline.to_dataframe(), extra_staff.to_dataframe(),
... "start", "end", label_a="baseline", label_b="extra staff")
<plotly.graph_objs._figure.Figure>