plot_travel_time_distribution
site.SiteSolutionSet.plot_travel_time_distribution(
top_n=1,
bottom_n=None,
rank_on=None,
secondary_ranking='max',
title='default',
height=None,
height_per_plot=250,
compare_to_best=False,
**kwargs,
)Plot travel time distributions for selected solutions.
This method generates faceted histograms of travel time (or cost) distributions for the top and/or bottom-performing solutions in the solution set. Each subplot corresponds to a single solution and includes summary statistics annotations.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| top_n | int | Number of top-ranked solutions to include. If rank_on is provided, solutions are sorted before selection; otherwise, the existing order, which is based on the objective chosen for solving, is used. |
1 |
| bottom_n | int | Number of bottom-ranked solutions to include. If provided, these are appended to the selected top solutions. | None |
| rank_on | str | Column name used to rank solutions. Sorting is performed in ascending order using this column, with secondary_ranking as a tie-breaker. If None, no additional sorting is applied. |
None |
| secondary_ranking | str | Secondary column used for tie-breaking when sorting by rank_on. |
"max" |
| title | str | Title for the plot. If “default”, an automatic title is generated based on ranking and objectives. | "default" |
| height | int | Total height of the figure in pixels. If None, height is determined dynamically using height_per_plot. |
None |
| height_per_plot | int | Height allocated per subplot when height is not specified. |
250 |
| compare_to_best | bool | If True, plots the difference in travel time relative to the best solution (i.e., min_cost_diff). Adds a vertical reference line at zero. If False, plots absolute travel times (min_cost). |
False |
| **kwargs | Additional keyword arguments passed to plotly.express.histogram. |
{} |
Returns
| Name | Type | Description |
|---|---|---|
| plotly.graph_objects.Figure | A Plotly figure containing faceted histograms of travel time distributions for the selected solutions. |
Notes
When compare_to_best=True, the best solution (first in the filtered set) is used as the reference for computing differences.
Subplots are arranged using facet_row, with annotations adjusted manually to align with subplot domains.
Vertical reference lines are added for key metrics when compare_to_best=False: - Weighted average - Unweighted average - 90th percentile - Maximum
The method assumes that lower values of the ranking metric correspond to better solutions.