fig_leg_forecasts¶
-
passengersim.contrast.fig_leg_forecasts(summaries: dict[str, SimulationTables], raw_df: bool =
False, by_leg_id: int | None =None, by_class: bool | str =True, of: 'mu' | 'sigma' | list['mu' | 'sigma'] ='mu', agg_booking_classes: bool =False, also_df: bool =False) Chart | DataFrame | tuple[Chart, DataFrame][source]¶ Generate a figure contrasting leg demand forecasts for one or more runs.
- Parameters:
- summaries : dict[str, SimulationTables]¶
One or more SimulationTables to compare.
- raw_df : bool, default False¶
If True, return the raw DataFrame instead of the chart.
- by_leg_id : int, optional¶
If provided, show forecasts only for this specific leg ID. If None, the chart is faceted by flight number.
- by_class : bool or str, default True¶
If True, differentiate booking classes by color. If a string, filter to only that booking class and color by source instead.
- of : {'mu', 'sigma'} or list thereof, default 'mu'¶
Which forecast statistic to display:
'mu'for mean demand forecast,'sigma'for standard deviation. Pass a list to display multiple statistics side-by-side.- agg_booking_classes : bool, default False¶
If True, aggregate (sum) across all booking classes before plotting, coloring by source rather than booking class.
- also_df : bool, default False¶
If True, return a tuple of
(figure, dataframe)instead of just the figure.
- 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.