I have the following data stored in a geopandas.DataFrame
object. geometry
are polygons and x
are the values I want to use as a heat scale.
id geometry x
9 01001 POLYGON ((-102.10641 22.06035, -102.10368 22.0... 33
19 01002 POLYGON ((-102.05189 22.29144, -102.05121 22.2... 2
29 01003 POLYGON ((-102.68569 22.09963, -102.69087 22.0... 0
39 01004 POLYGON ((-102.28787 22.41649, -102.28753 22.4... 0
49 01005 POLYGON ((-102.33568 22.05067, -102.33348 22.0... 22
I can use the following code to plot a map and color each polygon according to the value in column x
.
t.plot(column='x', cmap='coolwarm', legend=False)
plt.axis('off')
plt.show()
This is not too bad, but considering I have the polygons and values in a single object, I was wondering if theres a way to turn this plot into a heatmap using geopandas
.