pysal.viz.splot.libpysal.plot_spatial_weights(w, gdf, indexed_on=None, ax=None, figsize=(10, 10), node_kws=None, edge_kws=None, nonplanar_edge_kws=None)[source]

Plot spatial weights network. NOTE: Additionally plots w.non_planar_joins if pysal.lib.weights.util.nonplanar_neighbors() was applied.

fig : matplotlip Figure instance

Figure of spatial weight network.

ax : matplotlib Axes instance

Axes in which the figure is plotted.



>>> from pysal.lib.weights.contiguity import Queen
>>> import geopandas as gpd
>>> import pysal.lib
>>> from pysal.lib import examples
>>> import matplotlib.pyplot as plt
>>> from pysal.viz.splot.libpysal import plot_spatial_weights

Data preparation and statistical analysis

>>> gdf = gpd.read_file(examples.get_path('map_RS_BR.shp'))
>>> weights = Queen.from_dataframe(gdf)
>>> wnp = pysal.lib.weights.util.nonplanar_neighbors(weights, gdf)

Plot weights

>>> plot_spatial_weights(weights, gdf)

Plot corrected weights

>>> plot_spatial_weights(wnp, gdf)

(Source code)