plot_n_best_combinations_bar
site.SiteSolutionSet.plot_n_best_combinations_bar(
y_axis='weighted_average',
n_best=10,
interactive=True,
rank_on=None,
title='default',
)Plot a bar chart of the top-performing site combinations.
This method visualises the performance of the top n_best solutions using a bar chart, where each bar represents a solution and its value corresponds to the selected metric (e.g., weighted average travel time).
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| y_axis | str | Column name representing the metric to plot on the y-axis. This should correspond to a column in solution_df. |
"weighted_average" |
| n_best | int | Number of top solutions to include in the plot. If None, all solutions are included. | 10 |
| interactive | bool | If True, generates an interactive Plotly bar chart. If False, generates a static Matplotlib bar chart. | True |
| rank_on | str | Column name used to rank solutions. If provided, solutions are sorted in ascending order before selecting the top n_best. If None, the existing order of solution_df is used. |
None |
| title | str or None | Title for the plot. If “default”, an automatic title is generated based on the ranking metric or objective. If None, no title is set. Otherwise, the provided string is used as the title. | "default" |
Returns
| Name | Type | Description |
|---|---|---|
| plotly.graph_objects.Figure or matplotlib.figure.Figure | The generated bar chart. Returns a Plotly Figure if interactive=True, otherwise a Matplotlib Figure. |
Notes
The x-axis represents the selected site combinations (site_indices), which are converted to strings for display.
When interactive=True, Plotly Express is used to generate the chart. When interactive=False, a Matplotlib figure is created and returned.
The method assumes that lower values of the ranking metric correspond to better solutions when rank_on is specified.