fig_segmentation_detail

passengersim.summaries.segmentation_detail.fig_segmentation_detail(summaries: Contrast, *, by_carrier: bool | str = True, by_class: bool | str = False, orig: str | None = None, dest: str | None = None, metric: 'bookings' | 'revenue' = 'bookings', raw_df: bool = False, also_df: bool = False, width: int | None = 400, height: int | None = 180) → alt.Chart | pd.DataFrame | tuple[alt.Chart, pd.DataFrame][source]

Plot the segmentation detail data.

Parameters:
summaries : Contrast

The contrast object containing the segmentation detail data.

by_carrier : bool or str, default True

If True, group by carrier. If a string, filter by carrier.

by_class : bool or str, default False

If True, group by booking class. If a string, filter by booking class.

orig : str, optional

Filter by origin.

dest : str, optional

Filter by destination.

metric : {"bookings", "revenue"}, default "bookings"

Which measure to plot. Revenue is only available from SegmentationTracer data.

raw_df : bool, default False

If True, return the raw dataframe instead of the figure.

also_df : bool, default False

If True, return the dataframe as well as the figure.

width : int, optional

The width of the figure. Default is 400.

height : int, optional

The height of the figure. Default is 180.

Returns:

alt.Chart or pd.DataFrame or tuple[alt.Chart, pd.DataFrame] – The segmentation detail figure or dataframe.