Skip to content

Instantly share code, notes, and snippets.

@dsibi
Created May 22, 2020 14:47
Show Gist options
  • Save dsibi/3ad00be096a52f60c86d68d9bfd1eabe to your computer and use it in GitHub Desktop.
Save dsibi/3ad00be096a52f60c86d68d9bfd1eabe to your computer and use it in GitHub Desktop.
Rent Owerview
#Now this part of code gives me figures for each cells on each map region, even on these which has no data at all. How to show it only for regions which has values in initial table?
import matplotlib as mpl
import matplotlib.pyplot as plt
import geopandas as gpd
import pandas as pd
...
variable = 'price'
vmin, vmax = 10,90
fig=plt.figure(figsize=(12,12))
axK = fig.add_subplot(2,2,1)
mergedK.plot(column=variable, cmap='Blues',
vmin=vmin,
vmax=vmax,
linewidth=0.8, ax=axK, edgecolor='0.8')
for _,region in merged2.iterrows():
if pd.notna(region['price']):
ax2.annotate(region['price'],
xy=(region.geometry.centroid.x,
region.geometry.centroid.y),fontsize=8)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment