check_solution_equity
site.SiteSolutionSet.check_solution_equity(
solution_rank=1,
return_plot=False,
interactive=True,
title='default',
show_average=True,
plot_solution_metric_as_line='weighted_average',
sort_by=None,
ax=None,
colour_mode=None,
show_site_names=False,
matrix=None,
)Summarise and optionally plot equity metrics for a selected solution.
This method computes the mean minimum cost (min_cost) grouped by the configured equity category for a given solution. It can return either the aggregated data or a visualisation using Plotly (interactive) or Matplotlib (static).
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| solution_rank | int | Rank of the solution to evaluate (1-indexed). | 1 |
| return_plot | bool | If True, return a plot instead of the summary DataFrame. | False |
| title | str | Title for the plot. If “default”, a title is generated automatically. | "default" |
| show_average | bool | If True, display the overall average of min_cost as a horizontal dotted line on the plot. |
True |
| sort_by | str or None | Column name used to rank solutions before selecting the specified solution_rank. If None, the existing order is used. |
None |
| interactive | bool | If True, return an interactive Plotly figure. If False, return a Matplotlib figure. | True |
| ax | matplotlib.axes.Axes or None | Existing Matplotlib axes to plot on when interactive=False. If None, a new figure and axes are created. |
None |
| show_site_names | bool | If True, the default plot title lists the selected sites by name (site_names) instead of by index (site_indices). |
False |
| matrix | str | Label of a secondary travel matrix registered via add_secondary_travel_matrix(). If provided, the summary is computed from that matrix’s own min-cost column instead of the primary travel matrix. |
None |
Returns
| Name | Type | Description |
|---|---|---|
| pandas.DataFrame or plotly.graph_objs._figure.Figure or matplotlib.figure.Figure | If return_plot=False, returns a DataFrame with mean min_cost per equity group, in ascending raw-band order. Otherwise, returns a Plotly or Matplotlib figure depending on the interactive flag – the plotted bars are reordered most- to least-disadvantaged per add_equity_data(disadvantaged_end=...) (ties within a tertile keep ascending band order, matching population_impact_by_equity_group()’s own ordering), and the equity axis is labelled “(most to least disadvantaged)” so the direction is never left for the reader to guess. The un-plotted DataFrame is intentionally left in its original ascending order – only the chart’s bar order/label changes. |
Notes
- The equity grouping column is defined by
self.site_problem._equity_data_equity_col. - The plotted metric is the mean of
min_costwithin each group. - When using Matplotlib with a provided
ax, the plot is drawn onto the supplied axes and the corresponding figure is returned.