pysal.viz.splot.esda.lisa_cluster(moran_loc, gdf, p=0.05, ax=None, legend=True, legend_kwds=None, **kwargs)[source]

Create a LISA Cluster map

moran_loc : esda.moran.Moran_Local or Moran_Local_BV instance

Values of Moran’s Local Autocorrelation Statistic

gdf : geopandas dataframe instance

The Dataframe containing information to plot. Note that gdf will be modified, so calling functions should use a copy of the user provided gdf. (either using gdf.assign() or gdf.copy())

p : float, optional

The p-value threshold for significance. Points will be colored by significance.

ax : matplotlib Axes instance, optional

Axes in which to plot the figure in multiple Axes layout. Default = None

legend : boolean, optional

If True, legend for maps will be depicted. Default = True

legend_kwds : dict, optional

Dictionary to control legend formatting options. Example: legend_kwds={'loc': 'upper left', 'bbox_to_anchor': (0.92, 1.05)} Default = None

**kwargs : keyword arguments, optional

Keywords designing and passed to geopandas.GeoDataFrame.plot().

fig : matplotlip Figure instance

Figure of LISA cluster map

ax : matplotlib Axes instance

Axes in which the figure is plotted



>>> import matplotlib.pyplot as plt
>>> from pysal.lib.weights.contiguity import Queen
>>> from pysal.lib import examples
>>> import geopandas as gpd
>>> from pysal.explore.esda.moran import Moran_Local
>>> from pysal.viz.splot.esda import lisa_cluster

Data preparation and statistical analysis

>>> link = examples.get_path('Guerry.shp')
>>> gdf = gpd.read_file(link)
>>> y = gdf['Donatns'].values
>>> w = Queen.from_dataframe(gdf)
>>> w.transform = 'r'
>>> moran_loc = Moran_Local(y, w)


>>> fig = lisa_cluster(moran_loc, gdf)

(Source code, png, hires.png, pdf)