fig_displacement_history¶
-
passengersim.contrast.fig_displacement_history(summaries: dict[str, SimulationTables], *, by_carrier: bool | str =
True, show_stdev: float | bool | None =None, raw_df: bool =False, title: str | None ='Displacement Cost History', also_df: bool =False, width: int =225, height: int =125) Chart | DataFrame | tuple[Chart, DataFrame][source]¶ Generate a figure contrasting displacement cost history for one or more runs.
Plots average displacement costs vs. days prior to departure, with one line per source. When multiple carriers are present and
by_carrieris not a string, the chart is faceted by carrier.- Parameters:
- summaries : dict[str, SimulationTables]¶
One or more SimulationTables to compare.
- by_carrier : bool or str, default True¶
If True, facet the chart by carrier. If a string, filter to only that carrier and return a single unfaceted chart.
- show_stdev : float or bool, optional¶
If truthy, overlay a shaded band and dashed boundary lines showing the displacement cost distribution width. Requires
by_carrierto be a specific carrier string.- raw_df : bool, default False¶
If True, return the raw DataFrame instead of the chart.
- title : str, optional¶
Chart title. Defaults to
"Displacement Cost History". PassNonefor no title.- also_df : bool, default False¶
If True, return a tuple of
(figure, dataframe)instead of just the figure.- width : int, default 225¶
Width of each facet panel in pixels.
- height : int, default 125¶
Height of each facet panel in pixels.
- Returns:
alt.Chart or pd.DataFrame or tuple[alt.Chart, pd.DataFrame] – The Altair chart, or the raw DataFrame if
raw_dfis True, or a(chart, dataframe)tuple ifalso_dfis True.- Raises:
NotImplementedError – If
show_stdevis truthy andby_carrieris not a specific carrier string.