plot_allocated_utilisation

site.SiteSolutionSet.plot_allocated_utilisation(
    capacity_df=None,
    capacity_col=None,
    demand_to_capacity_rate=1.0,
    sort_by=None,
    solution_rank=1,
    site_names=None,
    site_indices=None,
    matrix=None,
    demand=None,
    interactive=False,
    cmap='RdYlGn_r',
    missing_site_colour='lightgrey',
    marker_size_range=(40, 220),
    show_labels=False,
    add_basemap=True,
    tiles='CartoDB positron',
    title=None,
    caption=None,
    ax=None,
    figsize=None,
    **kwargs,
)

Map each selected site’s allocated_utilisation_ratio from site_capacity_summary().

Site markers are coloured (and, on a static map, sized) by how full each site is under this solution’s allocation, so pressure points are visible geographically rather than only in a table or bar chart. Unlike plot_site_utilisation() (today’s real-world baseline, independent of any solve), this is solve-derived: only sites selected by the chosen solution are drawn, matching site_capacity_summary()’s own scope.

Parameters

Name Type Description Default
capacity_df pandas.DataFrame A precomputed result from site_capacity_summary(). If given, capacity_col/demand_to_capacity_rate/the selection arguments below are ignored, matching plot_site_utilisation(utilisation_df=...). None
capacity_col None
demand_to_capacity_rate None
sort_by None
solution_rank None
site_names Passed straight through to site_capacity_summary() when capacity_df is not supplied. None
site_indices Passed straight through to site_capacity_summary() when capacity_df is not supplied. None
matrix Passed straight through to site_capacity_summary() when capacity_df is not supplied. None
demand Passed straight through to site_capacity_summary() when capacity_df is not supplied. None
interactive bool If True, returns an interactive Folium map via .explore(). Otherwise returns a static matplotlib Axes. False
cmap str Colormap for site markers. The reversed variant, matching plot_site_utilisation’s own default and for the same reason: a high ratio here is bad (near/at/over capacity), so red must map to the high end. "RdYlGn_r"
missing_site_colour str Colour (and static marker size, at the smallest of marker_size_range) for a selected site with no capacity registered (NaN ratio). "lightgrey"
marker_size_range tuple of (float, float) Smallest and largest static marker size, linearly scaled by allocated_utilisation_ratio. Ignored on interactive maps. (40, 220)
show_labels bool If True, adds text labels for each site (see plot_sites). False
add_basemap bool If True, adds a background web map. True
title str Axes title. Ignored on interactive maps. None
caption str or None None prints a short “how to read this” explanation; pass "" to suppress it or a custom string to replace it. Static branch only, via _add_plot_caption. None
ax matplotlib.axes.Axes None
figsize tuple None
**kwargs dict Additional keyword arguments passed to the site plotting call (GeoDataFrame.plot/.explore). {}

Returns

Name Type Description
matplotlib.axes.Axes or folium.Map

Raises

Name Type Description
ValueError If candidate_sites has no real geometry (i.e. add_sites() was never given a GeoDataFrame or lat/long columns).

Notes

Only sites selected by the chosen solution are drawn – an unselected candidate site would otherwise have to be shown grey, but grey already means “no capacity registered” on this map, and conflating “not chosen” with “chosen but not measured” would be actively misleading. plot_best_combination() is the map for “which sites were chosen”; this one assumes that question is already answered.

A site with an infinite ratio (zero registered capacity, nonzero allocated load) would otherwise flatten every other marker to a uniform size/colour (an infinite range swallows every finite value), so it is substituted with the largest finite ratio times 1.05 for sizing/colouring purposes only – the tooltip/popup still shows the true (infinite) value.

Back to top