I'm trying to make a small multiples map chart; something like this
with GeoPandas and Altair. My dataset has the following fields:
weekNumberpercentageDiffgeometry
I want to create a map for each weekNumber showing the values in the percentageDiff column.
I've managed to make multiple maps on one row, but not in a grid like this one. Here's my code for the maps on one row:
charts = []
for x in range(12):
chart = alt.Chart(ntaGeoData[ntaGeoData.weekNumber == x]).mark_geoshape().encode(
color=alt.Color(
'percentageDiff:Q',
scale=alt.Scale(scheme='redblue',domain=(-1,1)))
).properties(
width=200,
height=200
)
charts.append(chart)
alt.hconcat(*charts)
Any ideas? Thank you!
The actual data looks like this:
geometry weekNumber citiStartDiff NTAName
0 POLYGON ((-73.99236 40.68969, -73.99436 40.690... 0 -0.319463 Brooklyn Heights-Cobble Hill
1 POLYGON ((-73.99236 40.68969, -73.99436 40.690... 1 0.232122 Brooklyn Heights-Cobble Hill
2 POLYGON ((-73.99236 40.68969, -73.99436 40.690... 2 0.101468 Brooklyn Heights-Cobble Hill
3 POLYGON ((-73.99236 40.68969, -73.99436 40.690... 3 0.191144 Brooklyn Heights-Cobble Hill
4 POLYGON ((-73.99236 40.68969, -73.99436 40.690... 4 0.378864 Brooklyn Heights-Cobble Hill
... ... ... ... ...
6147 MULTIPOLYGON (((-73.86523 40.57046, -73.86454 ... 4 2.520000 park-cemetery-etc-Queens
6148 MULTIPOLYGON (((-73.86523 40.57046, -73.86454 ... 5 0.030769 park-cemetery-etc-Queens
6149 MULTIPOLYGON (((-73.86523 40.57046, -73.86454 ... 6 -0.015625 park-cemetery-etc-Queens
6150 MULTIPOLYGON (((-73.86523 40.57046, -73.86454 ... 7 1.150000 park-cemetery-etc-Queens
6151 MULTIPOLYGON (((-73.86523 40.57046, -73.86454 ... 8 0.509804 park-cemetery-etc-Queens

