def test_moran_loc_scatterplot(): df = _test_data_columbus() x = df['INC'].values y = df['HOVAL'].values w = Queen.from_dataframe(df) w.transform = 'r' moran_loc = Moran_Local(y, w) moran_bv = Moran_BV(x, y, w) # try without p value fig, _ = _moran_loc_scatterplot(moran_loc) plt.close(fig) # try with p value and different figure size fig, _ = _moran_loc_scatterplot(moran_loc, p=0.05, aspect_equal=False, fitline_kwds=dict(color='#4393c3')) plt.close(fig) # try with p value and zstandard=False fig, _ = _moran_loc_scatterplot(moran_loc, p=0.05, zstandard=False, fitline_kwds=dict(color='#4393c3')) plt.close(fig) # try without p value and zstandard=False fig, _ = _moran_loc_scatterplot(moran_loc, zstandard=False, fitline_kwds=dict(color='#4393c3')) plt.close(fig) raises(ValueError, _moran_loc_scatterplot, moran_bv, p=0.5) warns(UserWarning, _moran_loc_scatterplot, moran_loc, p=0.5, scatter_kwds=dict(c='#4393c3'))
def test_moran_bv_scatterplot(): gdf = _test_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 fig, _ = _moran_bv_scatterplot(moran_bv) plt.close(fig) # customize plot fig, _ = _moran_bv_scatterplot(moran_bv, aspect_equal=False, fitline_kwds=dict(color='#4393c3')) plt.close(fig)
def test_moran_bv_scatterplot(): 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 fig, _ = _moran_bv_scatterplot(moran_bv) plt.close(fig) # customize plot fig, _ = _moran_bv_scatterplot(moran_bv, fitline_kwds=dict(color='#4393c3')) plt.close(fig)
def test_plot_moran_bv(): # 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 fig, _ = plot_moran_bv(moran_bv) plt.close(fig) # customize plot fig, _ = plot_moran_bv(moran_bv, aspect_equal=False, fitline_kwds=dict(color='#4393c3')) plt.close(fig)
def test_moran_loc_scatterplot(): columbus = examples.load_example('Columbus') link_to_data = columbus.get_path('columbus.shp') df = gpd.read_file(link_to_data) x = df['INC'].values y = df['HOVAL'].values w = Queen.from_dataframe(df) w.transform = 'r' moran_loc = Moran_Local(y, w) moran_bv = Moran_BV(x, y, w) # try without p value fig, _ = _moran_loc_scatterplot(moran_loc) plt.close(fig) # try with p value and different figure size fig, _ = _moran_loc_scatterplot(moran_loc, p=0.05, aspect_equal=False, fitline_kwds=dict(color='#4393c3')) plt.close(fig) # try with p value and zstandard=False fig, _ = _moran_loc_scatterplot(moran_loc, p=0.05, zstandard=False, fitline_kwds=dict(color='#4393c3')) plt.close(fig) # try without p value and zstandard=False fig, _ = _moran_loc_scatterplot(moran_loc, zstandard=False, fitline_kwds=dict(color='#4393c3')) plt.close(fig) assert_raises(ValueError, _moran_loc_scatterplot, moran_bv, p=0.5) assert_warns(UserWarning, _moran_loc_scatterplot, moran_loc, p=0.5, scatter_kwds=dict(c='#4393c3'))
def test_moran_scatterplot(): gdf = _test_data() x = gdf['Suicids'].values y = gdf['Donatns'].values w = Queen.from_dataframe(gdf) w.transform = 'r' # Calculate `esda.moran` Objects moran = Moran(y, w) moran_bv = Moran_BV(y, x, w) moran_loc = Moran_Local(y, w) moran_loc_bv = Moran_Local_BV(y, x, w) # try with p value so points are colored or warnings apply fig, _ = moran_scatterplot(moran, p=0.05, aspect_equal=False) plt.close(fig) fig, _ = moran_scatterplot(moran_loc, p=0.05) plt.close(fig) fig, _ = moran_scatterplot(moran_bv, p=0.05) plt.close(fig) fig, _ = moran_scatterplot(moran_loc_bv, p=0.05) plt.close(fig)
def test_moran_scatterplot(): 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 `esda.moran` Objects moran = Moran(y, w) moran_bv = Moran_BV(y, x, w) moran_loc = Moran_Local(y, w) moran_loc_bv = Moran_Local_BV(y, x, w) # try with p value so points are colored or warnings apply fig, _ = moran_scatterplot(moran, p=0.05) plt.close(fig) fig, _ = moran_scatterplot(moran_loc, p=0.05) plt.close(fig) fig, _ = moran_scatterplot(moran_bv, p=0.05) plt.close(fig) fig, _ = moran_scatterplot(moran_loc_bv, p=0.05) plt.close(fig)