plot_hotspots

site.SiteProblem.plot_hotspots(
    hotspots_df=None,
    ax=None,
    interactive=False,
    show_hotspots=True,
    show_coldspots=True,
    show_low_high_outliers=True,
    show_high_low_outliers=True,
    show_non_significance=True,
    hotspot_colour='#d7191c',
    coldspot_colour='#2c7bb6',
    low_high_outlier_colour='#abd9e9',
    high_low_outlier_colour='#fee08b',
    not_significant_colour='#bdbdbd',
    tiles='CartoDB positron',
    edgecolor='black',
    linewidth=0.5,
    show_basemap=True,
    show_axis=False,
    opacity=0.7,
    what='demand',
    combination_method='multiply',
    neighbourhood_method='rook',
    k=None,
    verbose=True,
    significance_threshold=0.05,
    force_weight_recalculation=False,
    figsize=None,
    **kwargs,
)

Plot statistically significant hotspots and coldspots.

Creates either a static GeoPandas choropleth or an interactive Folium map showing the results of Local Moran’s I analysis. Areas are coloured according to hotspot classification.

Parameters

Name Type Description Default
hotspots_df geopandas.GeoDataFrame Hotspot analysis results returned by :meth:get_hotspots. If None, hotspot analysis is performed automatically using the supplied parameters. None
interactive bool If True, return an interactive Folium map. Otherwise, return a static GeoPandas plot. False
hotspot_colour str Colour used for statistically significant hotspot (high-high) regions. "#d7191c"
coldspot_colour str Colour used for statistically significant coldspot (low-low) regions. "#2c7bb6"
low_high_outlier_colour str Colour used for low-high spatial outliers. "#abd9e9"
high_low_outlier_colour str Colour used for high-low spatial outliers. "#fee08b"
not_significant_colour str Colour used for regions that are not statistically significant. "#bdbdbd"
tiles str Tile provider used for interactive maps. "CartoDB positron"
edgecolor str Boundary colour used when plotting polygons. "black"
linewidth float Width of polygon boundaries. 0.5
what (demand, equity) Variable used for hotspot analysis when hotspots_df is not provided. "demand"
neighbourhood_method (rook, queen, k - nearest) Method used to define neighbouring regions. "rook"
k int Number of neighbours when neighbourhood_method="k-nearest". None
verbose bool Whether to print progress information. True
significance_threshold float Significance threshold used to classify hotspot and coldspot regions. 0.05
force_weight_recalculation bool If True, spatial weights are recalculated even if a cached version is available. False
figsize tuple | None Allow overriding size of static plot None
**kwargs Additional keyword arguments passed to GeoDataFrame.plot or GeoDataFrame.explore. {}

Returns

Name Type Description
matplotlib.axes.Axes or folium.Map Static or interactive hotspot map depending on the value of interactive.

Notes

Hotspot classifications are derived from Local Moran’s I and consist of:

  • Hotspot (high-high)
  • Coldspot (low-low)
  • Low-high spatial outlier
  • High-low spatial outlier
  • Not significant

The default colour scheme mirrors the conventions commonly used in GeoDa and PySAL visualisations.

Back to top