def moran_scatterplt(moran, bivariate=False, disease=''): if bivariate: fig, ax = moran_scatterplot(moran, p=0.05) ax.set_ylabel('Spatial lag (' + disease + ')') else: fig, ax = moran_scatterplot(moran, aspect_equal=True) ax.set_ylabel('Spatial lag de Suicídios') ax.set_xlabel('Suicídios') st.pyplot(fig)
def test_moran_scatterplot(): # Load data and apply statistical analysis link_to_data = examples.get_path('Guerry.shp') gdf = gpd.read_file(link_to_data) y = gdf['Donatns'].values w = lp.Queen.from_dataframe(gdf) w.transform = 'r' # Calc Global Moran w = lp.Queen.from_dataframe(gdf) moran = Moran(y, w) # plot fig, _ = moran_scatterplot(moran) plt.close(fig) # customize fig, _ = moran_scatterplot(moran, zstandard=False, fitline_kwds=dict(color='#4393c3')) plt.close(fig)
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)