plot_region_geometry_layer

site.SiteProblem.plot_region_geometry_layer(
    interactive=False,
    plot_demand=False,
    plot_equity=False,
    demand=None,
    cmap='Blues',
    plot_region_of_interest_only=False,
    edgecolor='black',
    linewidth=0.5,
    add_basemap=True,
    tiles='CartoDB positron',
    show_axis=False,
    title=None,
    **kwargs,
)

Visualize the regional geometry layer, optionally overlaid with demand data.

This method produces either a static matplotlib plot or an interactive Folium map (via Geopandas’ .explore()). If demand plotting is enabled, it performs an internal join between geometry and demand data to create a choropleth map.

Parameters

Name Type Description Default
interactive bool If True, returns a folium.Map object using the ‘explore’ backend. If False, returns a matplotlib.axes.Axes object. False
plot_demand bool If True, merges the geometry with the demand dataset and styles the regions based on the demand column values. False
demand str Label of a secondary demand scenario registered via add_secondary_demand(). When given (with plot_demand=True), plots that scenario’s demand instead of the primary demand data. Ignored (and rejected) when plot_demand=False. None
cmap Colour map to be used for plotting demand. Ignored if plot_demand=False. 'Blues'
tiles Tiles to be used for background in map. Ignored if interactive = False. 'CartoDB positron'
add_basemap bool If True, adds a background web map (via contextily for static plots, or the tiles basemap for interactive ones). Set False to skip the tile download entirely. .. versionchanged:: 0.7.0 Renamed from show_basemap, which has been removed. True
title str Title for a static plot (ax.set_title()). Ignored if interactive=True – a Folium map has no equivalent built-in title support. None (the default) leaves the plot untitled, matching prior behaviour. None
**kwargs dict Additional keyword arguments passed to either geopandas.GeoDataFrame.plot or geopandas.GeoDataFrame.explore. {}

Returns

Name Type Description
matplotlib.axes.Axes or folium.Map The plotting object depending on the interactive parameter.

Raises

Name Type Description
ValueError If self.region_geometry_layer has not been initialized.
ValueError If plot_demand is True but self.demand_data is None, if demand is given but plot_demand is False, or if demand does not name a registered secondary demand scenario.
TypeError If the removed show_basemap argument is supplied.

Notes

When plot_demand is True, the method performs a merge using: - self._region_geometry_layer_common_col (left) - self._demand_data_id_col (right)

Interactive maps default to the “CartoDB positron” tile set and the “Blues” colormap for demand visualization.

The static plot’s colour bar is labelled “Demand” (plot_demand= True) or with the human-readable add_equity_data(label=...), falling back to the raw equity column name if no label was registered (plot_equity=True) – previously unlabelled either way.

Back to top