splot.esda.plot_moran_bv_simulation¶
-
splot.esda.
plot_moran_bv_simulation
(moran_bv, ax=None, aspect_equal=True, fitline_kwds=None, **kwargs)[source]¶ Bivariate Moran’s I simulated reference distribution.
- Parameters
- moran_bvesda.moran.Moran_BV instance
Values of Bivariate Moran’s I Autocorrelation Statistics
- axMatplotlib Axes instance, optional
If given, the Moran plot will be created inside this axis. Default =None.
- aspect_equalbool, optional
If True, Axes of Moran Scatterplot will show the same aspect or visual proportions.
- fitline_kwdskeyword arguments, optional
Keywords used for creating and designing the vertical moran fitline. Default =None.
- **kwargskeyword arguments, optional
Keywords used for creating and designing the figure, passed to seaborne.kdeplot.
- Returns
- figMatplotlib Figure instance
Bivariate moran reference distribution figure
- axmatplotlib Axes instance
Axes in which the figure is plotted
Examples
Imports
>>> import matplotlib.pyplot as plt >>> from libpysal.weights.contiguity import Queen >>> from libpysal import examples >>> import geopandas as gpd >>> from esda.moran import Moran_BV >>> from splot.esda import plot_moran_bv_simulation
Load data and calculate weights
>>> link_to_data = examples.get_path('Guerry.shp') >>> gdf = gpd.read_file(link_to_data) >>> x = gdf['Suicids'].values >>> y = gdf['Donatns'].values >>> w = Queen.from_dataframe(gdf) >>> w.transform = 'r'
Calculate Bivariate Moran
>>> moran_bv = Moran_BV(x, y, w)
plot
>>> plot_moran_bv_simulation(moran_bv) >>> plt.show()
customize plot
>>> plot_moran_bv_simulation(moran_bv, ... fitline_kwds=dict(color='#4393c3')) >>> plt.show()