pandas_alive icon indicating copy to clipboard operation
pandas_alive copied to clipboard

Basemap does not fill consistent extent of plot when plotting `geopandas` features

Open robbibt opened this issue 2 years ago • 2 comments

Describe the bug When plotting a geopandas animation with a basemap supplied by basemap_format, the basemap extends only to the bounding box of the spatial data. In the example below, this causes a constantly changing basemap region (starting with a square and ending up with a longer rectangle). This is a disconcerting effect which distracts from the animation itself.

test

Expected behavior I would expect the basemap to fill a consistent portion of the total animation figure boundary regardless of the bounding box of the features currently being plotted. For example, I would expect basemap data to be plotted in the following region (red) for this frame:

image

And the same for this frame: image

To Reproduce

import geopandas as gpd
import pandas_alive
import matplotlib.pyplot as plt

# Load data from geojson
geojson_data = '{"type": "FeatureCollection", "features": [{"id": "097067", "type": "Feature", "properties": {"2020-01-01T01:22:37.127576Z": null, "2020-01-01T01:23:01.056739Z": null, "2020-01-01T01:23:24.985903Z": null, "2020-01-01T01:23:48.919302Z": null, "2020-01-01T01:24:12.852702Z": null, "2020-01-01T01:24:36.790337Z": null, "2020-01-01T01:25:00.723735Z": null, "2020-01-01T01:25:24.661371Z": null, "2020-01-01T01:25:48.599007Z": null, "2020-01-01T01:26:12.536642Z": null, "2020-01-01T01:26:36.478513Z": null, "2020-01-01T01:27:00.424621Z": null, "2020-01-01T01:27:24.374964Z": null, "2020-01-01T01:27:48.321071Z": null, "2020-01-01T01:28:12.262943Z": null, "2020-01-01T01:28:36.213286Z": null, "2020-01-01T01:29:00.167865Z": null, "2020-01-01T01:29:24.118207Z": null, "2020-01-02T00:26:59.463817Z": 29.867664138574362, "2020-01-02T00:27:23.392980Z": null}, "geometry": {"type": "Polygon", "coordinates": [[[143.91428035361733, -10.808771846671602], [143.9137014965743, -10.808646407382145], [143.91443129161283, -10.804561791263017], [143.96236371001456, -10.587449471886186], [144.10991715020089, -9.91728134220046], [144.21231262746187, -9.450744536185013], [144.2944827857594, -9.076132366431155], [144.29521051510125, -9.07628886669165], [144.29523218028365, -9.076205683919108], [145.97446706945252, -9.433148866436886], [145.99134034415968, -9.436990148774726], [145.99133594702138, -9.437018782993729], [145.99232425097716, -9.43723617914727], [145.62090338068282, -11.173615301039446], [145.61987686014714, -11.173398906348543], [145.61987422907097, -11.173407125668124], [143.9294347528281, -10.8123877461815], [143.91521160865008, -10.809264697635998], [143.91428035361733, -10.808771846671602]]]}}, {"id": "097068", "type": "Feature", "properties": {"2020-01-01T01:22:37.127576Z": null, "2020-01-01T01:23:01.056739Z": null, "2020-01-01T01:23:24.985903Z": null, "2020-01-01T01:23:48.919302Z": null, "2020-01-01T01:24:12.852702Z": null, "2020-01-01T01:24:36.790337Z": null, "2020-01-01T01:25:00.723735Z": null, "2020-01-01T01:25:24.661371Z": null, "2020-01-01T01:25:48.599007Z": null, "2020-01-01T01:26:12.536642Z": null, "2020-01-01T01:26:36.478513Z": null, "2020-01-01T01:27:00.424621Z": null, "2020-01-01T01:27:24.374964Z": null, "2020-01-01T01:27:48.321071Z": null, "2020-01-01T01:28:12.262943Z": null, "2020-01-01T01:28:36.213286Z": null, "2020-01-01T01:29:00.167865Z": null, "2020-01-01T01:29:24.118207Z": null, "2020-01-02T00:26:59.463817Z": null, "2020-01-02T00:27:23.392980Z": 34.80462667027474}, "geometry": {"type": "Polygon", "coordinates": [[[145.30913286709654, -12.618488141834789], [145.30908816509887, -12.618636760819879], [143.5937201619494, -12.253131086590175], [143.59373662459242, -12.253057353407678], [143.59310322188728, -12.252920277836918], [143.66500595778587, -11.929671534392405], [143.79250716856384, -11.355459745433562], [143.91443129161283, -10.804561791263017], [143.9771131029972, -10.521230534002695], [143.97796222930918, -10.521241450273058], [144.66632855176198, -10.668443156659169], [145.6822774166325, -10.882662748312352], [145.6822619317395, -10.882784457217609], [145.68318245055164, -10.882977063735982], [145.68317652508617, -10.883682567486442], [145.31068656283418, -12.61657260301841], [145.31008296000917, -12.618671141533998], [145.30913286709654, -12.618488141834789]]]}}, {"id": "106067", "type": "Feature", "properties": {"2020-01-01T01:22:37.127576Z": 92.28839450249258, "2020-01-01T01:23:01.056739Z": null, "2020-01-01T01:23:24.985903Z": null, "2020-01-01T01:23:48.919302Z": null, "2020-01-01T01:24:12.852702Z": null, "2020-01-01T01:24:36.790337Z": null, "2020-01-01T01:25:00.723735Z": null, "2020-01-01T01:25:24.661371Z": null, "2020-01-01T01:25:48.599007Z": null, "2020-01-01T01:26:12.536642Z": null, "2020-01-01T01:26:36.478513Z": null, "2020-01-01T01:27:00.424621Z": null, "2020-01-01T01:27:24.374964Z": null, "2020-01-01T01:27:48.321071Z": null, "2020-01-01T01:28:12.262943Z": null, "2020-01-01T01:28:36.213286Z": null, "2020-01-01T01:29:00.167865Z": null, "2020-01-01T01:29:24.118207Z": null, "2020-01-02T00:26:59.463817Z": null, "2020-01-02T00:27:23.392980Z": null}, "geometry": {"type": "Polygon", "coordinates": [[[130.00806271666028, -10.808760720865454], [130.0073044320351, -10.808596244145392], [130.3851395319774, -9.089332279604136], [130.38782264540103, -9.07711121924026], [130.38822442298596, -9.076193125732111], [130.3888242583388, -9.076322240375415], [130.38883874803957, -9.076258609742117], [132.05353305165664, -9.430073334850485], [132.08442872108205, -9.436578216208934], [132.08481733137484, -9.43684711305887], [132.08570298512865, -9.437038827852035], [132.0860815868322, -9.43730243082185], [131.87158394859458, -10.44177136571256], [131.714698027727, -11.17356427699734], [131.713738611739, -11.173362273028507], [131.71372425234694, -11.17342596785272], [130.0182985513368, -10.81133436941015], [130.0086804754553, -10.809194045053754], [130.00806271666028, -10.808760720865454]]]}}, {"id": "106068", "type": "Feature", "properties": {"2020-01-01T01:22:37.127576Z": null, "2020-01-01T01:23:01.056739Z": 98.16696146567573, "2020-01-01T01:23:24.985903Z": null, "2020-01-01T01:23:48.919302Z": null, "2020-01-01T01:24:12.852702Z": null, "2020-01-01T01:24:36.790337Z": null, "2020-01-01T01:25:00.723735Z": null, "2020-01-01T01:25:24.661371Z": null, "2020-01-01T01:25:48.599007Z": null, "2020-01-01T01:26:12.536642Z": null, "2020-01-01T01:26:36.478513Z": null, "2020-01-01T01:27:00.424621Z": null, "2020-01-01T01:27:24.374964Z": null, "2020-01-01T01:27:48.321071Z": null, "2020-01-01T01:28:12.262943Z": null, "2020-01-01T01:28:36.213286Z": null, "2020-01-01T01:29:00.167865Z": null, "2020-01-01T01:29:24.118207Z": null, "2020-01-02T00:26:59.463817Z": null, "2020-01-02T00:27:23.392980Z": null}, "geometry": {"type": "Polygon", "coordinates": [[[129.687369968105, -12.253099827309851], [129.68693956478307, -12.253006587207274], [129.68686515987946, -12.252449156388291], [130.07078189641607, -10.521095547832832], [130.07138481711394, -10.521225248185688], [130.0713989313729, -10.521161284256547], [131.7668427010805, -10.880589741703321], [131.77536724471986, -10.882411635180734], [131.7759397037145, -10.88280812613711], [131.7769801761577, -10.88303844343788], [131.6720699834156, -11.37305689458326], [131.40396203206524, -12.618718350117197], [131.40284499882242, -12.618665163767721], [131.40234538945023, -12.61856083707641], [131.40164433320348, -12.61860557077436], [131.39030022919962, -12.616266513995845], [129.72426959785258, -12.26139583430603], [129.68839087404686, -12.253621140241187], [129.687369968105, -12.253099827309851]]]}}, {"id": "106069", "type": "Feature", "properties": {"2020-01-01T01:22:37.127576Z": null, "2020-01-01T01:23:01.056739Z": null, "2020-01-01T01:23:24.985903Z": 90.0498490262895, "2020-01-01T01:23:48.919302Z": null, "2020-01-01T01:24:12.852702Z": null, "2020-01-01T01:24:36.790337Z": null, "2020-01-01T01:25:00.723735Z": null, "2020-01-01T01:25:24.661371Z": null, "2020-01-01T01:25:48.599007Z": null, "2020-01-01T01:26:12.536642Z": null, "2020-01-01T01:26:36.478513Z": null, "2020-01-01T01:27:00.424621Z": null, "2020-01-01T01:27:24.374964Z": null, "2020-01-01T01:27:48.321071Z": null, "2020-01-01T01:28:12.262943Z": null, "2020-01-01T01:28:36.213286Z": null, "2020-01-01T01:29:00.167865Z": null, "2020-01-01T01:29:24.118207Z": null, "2020-01-02T00:26:59.463817Z": null, "2020-01-02T00:27:23.392980Z": null}, "geometry": {"type": "Polygon", "coordinates": [[[131.09031906885653, -14.063226202407128], [131.09029367272683, -14.063274704204506], [131.03765020539686, -14.052602901169053], [129.36395512506684, -13.696900323826341], [129.3639761094108, -13.696807144556509], [129.36346929931952, -13.69669759152833], [129.47705138442598, -13.190704257754394], [129.75087921720228, -11.965705587393014], [129.75181850149036, -11.965907337086191], [129.75307453209152, -11.965909545418581], [129.7743032611266, -11.970463547062328], [131.45474947098708, -12.325654868016546], [131.46159018238853, -12.327276137523512], [131.46597791310654, -12.328193328688895], [131.46650185157063, -12.328456429080365], [131.13862275554254, -13.846209804786069], [131.09129583639879, -14.063429647818419], [131.09031906885653, -14.063226202407128]]]}}, {"id": "106070", "type": "Feature", "properties": {"2020-01-01T01:22:37.127576Z": null, "2020-01-01T01:23:01.056739Z": null, "2020-01-01T01:23:24.985903Z": null, "2020-01-01T01:23:48.919302Z": 77.97755515771955, "2020-01-01T01:24:12.852702Z": null, "2020-01-01T01:24:36.790337Z": null, "2020-01-01T01:25:00.723735Z": null, "2020-01-01T01:25:24.661371Z": null, "2020-01-01T01:25:48.599007Z": null, "2020-01-01T01:26:12.536642Z": null, "2020-01-01T01:26:36.478513Z": null, "2020-01-01T01:27:00.424621Z": null, "2020-01-01T01:27:24.374964Z": null, "2020-01-01T01:27:48.321071Z": null, "2020-01-01T01:28:12.262943Z": null, "2020-01-01T01:28:36.213286Z": null, "2020-01-01T01:29:00.167865Z": null, "2020-01-01T01:29:24.118207Z": null, "2020-01-02T00:26:59.463817Z": null, "2020-01-02T00:27:23.392980Z": null}, "geometry": {"type": "Polygon", "coordinates": [[[129.03787166242506, -15.14057647904133], [129.0371310267789, -15.140416752035131], [129.03660280110287, -15.140148834237252], [129.2697625360147, -14.111543683068914], [129.4271915828486, -13.412825333094714], [129.4277414735554, -13.410383007422752], [129.42801460800325, -13.410005068204857], [129.4287371800396, -13.410007018876392], [129.43449488474135, -13.411240024729137], [129.4475478960092, -13.413843101496171], [131.13486430032947, -13.769296117920009], [131.15237124959634, -13.772939057833149], [131.15297580869841, -13.773241034900439], [131.15311046888107, -13.773269050732075], [131.15418986303615, -13.773662198421981], [131.14075284080474, -13.836431724149593], [130.77765486302226, -15.504478735221893], [130.77671066985758, -15.508117096025881], [130.77481300493685, -15.507724215273829], [130.77336076783587, -15.507663107340992], [129.03898567599336, -15.141023485305219], [129.03787166242506, -15.14057647904133]]]}}, {"id": "106071", "type": "Feature", "properties": {"2020-01-01T01:22:37.127576Z": null, "2020-01-01T01:23:01.056739Z": null, "2020-01-01T01:23:24.985903Z": null, "2020-01-01T01:23:48.919302Z": null, "2020-01-01T01:24:12.852702Z": 63.85976153132652, "2020-01-01T01:24:36.790337Z": null, "2020-01-01T01:25:00.723735Z": null, "2020-01-01T01:25:24.661371Z": null, "2020-01-01T01:25:48.599007Z": null, "2020-01-01T01:26:12.536642Z": null, "2020-01-01T01:26:36.478513Z": null, "2020-01-01T01:27:00.424621Z": null, "2020-01-01T01:27:24.374964Z": null, "2020-01-01T01:27:48.321071Z": null, "2020-01-01T01:28:12.262943Z": null, "2020-01-01T01:28:36.213286Z": null, "2020-01-01T01:29:00.167865Z": null, "2020-01-01T01:29:24.118207Z": null, "2020-01-02T00:26:59.463817Z": null, "2020-01-02T00:27:23.392980Z": null}, "geometry": {"type": "Polygon", "coordinates": [[[128.70693799205378, -16.583328833428812], [128.7063615335003, -16.583204806317543], [128.70628793495285, -16.582647494339074], [128.7272262312719, -16.491689623807975], [128.92936200732544, -15.610284609731272], [129.10180770782844, -14.853703052269678], [129.10253956520535, -14.853859668137844], [129.1025746082386, -14.853770521194136], [130.80112235912682, -15.210041211802244], [130.83776393696496, -15.217606987105952], [130.83875340843235, -15.218098611592525], [130.83987351384636, -15.218328822691154], [130.83410511700342, -15.245787336081994], [130.77657944074852, -15.509502901029913], [130.49536111097373, -16.790369518565225], [130.46326536464557, -16.93537629806664], [130.45941242256035, -16.95200828494311], [130.45871935048214, -16.95204974447574], [130.45758341392596, -16.951816458517886], [130.45678632989294, -16.951857079038106], [130.4426792893811, -16.948974907345626], [128.7069162264245, -16.583423299209823], [128.70693799205378, -16.583328833428812]]]}}, {"id": "106072", "type": "Feature", "properties": {"2020-01-01T01:22:37.127576Z": null, "2020-01-01T01:23:01.056739Z": null, "2020-01-01T01:23:24.985903Z": null, "2020-01-01T01:23:48.919302Z": null, "2020-01-01T01:24:12.852702Z": null, "2020-01-01T01:24:36.790337Z": 66.10098387009742, "2020-01-01T01:25:00.723735Z": null, "2020-01-01T01:25:24.661371Z": null, "2020-01-01T01:25:48.599007Z": null, "2020-01-01T01:26:12.536642Z": null, "2020-01-01T01:26:36.478513Z": null, "2020-01-01T01:27:00.424621Z": null, "2020-01-01T01:27:24.374964Z": null, "2020-01-01T01:27:48.321071Z": null, "2020-01-01T01:28:12.262943Z": null, "2020-01-01T01:28:36.213286Z": null, "2020-01-01T01:29:00.167865Z": null, "2020-01-01T01:29:24.118207Z": null, "2020-01-02T00:26:59.463817Z": null, "2020-01-02T00:27:23.392980Z": null}, "geometry": {"type": "Polygon", "coordinates": [[[128.37281993295176, -18.025717737654215], [128.37210159203434, -18.025482273993145], [128.37210732271288, -18.024775666040682], [128.3785824234838, -17.996732827730195], [128.44492634595844, -17.711410008247817], [128.5980149795141, -17.051617802822715], [128.7631139274434, -16.335522204930417], [128.77172380006064, -16.298105578375335], [128.77214274018147, -16.297186235995568], [128.7727455865398, -16.297245219079095], [128.7727746464901, -16.297119115367803], [130.52198813879266, -16.662682716363534], [130.52199658945614, -16.66276872836035], [130.5231230969374, -16.662998960565094], [130.5232010688509, -16.663419003191965], [130.52143833518613, -16.67170095360451], [130.51329389590924, -16.709039786371104], [130.13989229854855, -18.39459347901251], [130.13947748614768, -18.39578683727089], [130.13858116422185, -18.395603669883187], [130.13855413808997, -18.395724591840064], [128.74057123526694, -18.10427014531466], [128.37334496813304, -18.02588983591451], [128.3730502972487, -18.02579324765607], [128.37282135402697, -18.025744122856544], [128.37281993295176, -18.025717737654215]]]}}, {"id": "106073", "type": "Feature", "properties": {"2020-01-01T01:22:37.127576Z": null, "2020-01-01T01:23:01.056739Z": null, "2020-01-01T01:23:24.985903Z": null, "2020-01-01T01:23:48.919302Z": null, "2020-01-01T01:24:12.852702Z": null, "2020-01-01T01:24:36.790337Z": null, "2020-01-01T01:25:00.723735Z": 85.8496352819355, "2020-01-01T01:25:24.661371Z": null, "2020-01-01T01:25:48.599007Z": null, "2020-01-01T01:26:12.536642Z": null, "2020-01-01T01:26:36.478513Z": null, "2020-01-01T01:27:00.424621Z": null, "2020-01-01T01:27:24.374964Z": null, "2020-01-01T01:27:48.321071Z": null, "2020-01-01T01:28:12.262943Z": null, "2020-01-01T01:28:36.213286Z": null, "2020-01-01T01:29:00.167865Z": null, "2020-01-01T01:29:24.118207Z": null, "2020-01-02T00:26:59.463817Z": null, "2020-01-02T00:27:23.392980Z": null}, "geometry": {"type": "Polygon", "coordinates": [[[128.03393005855898, -19.46709620053533], [128.03319701774427, -19.466917631331725], [128.0411186359046, -19.432638185948313], [128.170015494341, -18.886728818558517], [128.43790023330112, -17.741759599204205], [128.4386114421374, -17.739485880629548], [128.43924859367542, -17.73960967228387], [128.43938979276805, -17.739420316922295], [130.20285497843008, -18.106360715030313], [130.20282224703763, -18.10650861174279], [130.20375217084913, -18.106705080073613], [130.20379405873996, -18.10723622646962], [130.20049369499938, -18.12216778524136], [129.81667568458957, -19.83864254781606], [129.81564055964316, -19.838432538149593], [129.81560106657201, -19.838579692756106], [128.4267746878048, -19.550733173239525], [128.03830363316033, -19.46816153699595], [128.03683700508878, -19.467804301818695], [128.03392224386334, -19.467180957218158], [128.03393005855898, -19.46709620053533]]]}}, {"id": "106074", "type": "Feature", "properties": {"2020-01-01T01:22:37.127576Z": null, "2020-01-01T01:23:01.056739Z": null, "2020-01-01T01:23:24.985903Z": null, "2020-01-01T01:23:48.919302Z": null, "2020-01-01T01:24:12.852702Z": null, "2020-01-01T01:24:36.790337Z": null, "2020-01-01T01:25:00.723735Z": null, "2020-01-01T01:25:24.661371Z": 57.33606207184423, "2020-01-01T01:25:48.599007Z": null, "2020-01-01T01:26:12.536642Z": null, "2020-01-01T01:26:36.478513Z": null, "2020-01-01T01:27:00.424621Z": null, "2020-01-01T01:27:24.374964Z": null, "2020-01-01T01:27:48.321071Z": null, "2020-01-01T01:28:12.262943Z": null, "2020-01-01T01:28:36.213286Z": null, "2020-01-01T01:29:00.167865Z": null, "2020-01-01T01:29:24.118207Z": null, "2020-01-02T00:26:59.463817Z": null, "2020-01-02T00:27:23.392980Z": null}, "geometry": {"type": "Polygon", "coordinates": [[[127.6901682615305, -20.90816558021579], [127.6894307449565, -20.908008517047445], [127.7410861122638, -20.691722128119906], [127.94002639939688, -19.85888403079116], [128.0880851345025, -19.234032899960933], [128.100354454165, -19.182177924304266], [128.10063915325526, -19.181666526880544], [128.10137554192198, -19.18176979667867], [128.10142412802173, -19.1816025974577], [129.8625076381003, -19.545863421597698], [129.87826079293967, -19.549042451842404], [129.87944432959713, -19.549465442082244], [129.8802983211316, -19.549637496922287], [129.88155686480712, -19.550034884195135], [129.4909368947102, -21.280090183367168], [129.4905099019211, -21.28114687048309], [129.48959693884086, -21.28096304732437], [129.4895697987457, -21.281081842451346], [127.69019381394567, -20.908364220951142], [127.6901682615305, -20.90816558021579]]]}}, {"id": "106075", "type": "Feature", "properties": {"2020-01-01T01:22:37.127576Z": null, "2020-01-01T01:23:01.056739Z": null, "2020-01-01T01:23:24.985903Z": null, "2020-01-01T01:23:48.919302Z": null, "2020-01-01T01:24:12.852702Z": null, "2020-01-01T01:24:36.790337Z": null, "2020-01-01T01:25:00.723735Z": null, "2020-01-01T01:25:24.661371Z": null, "2020-01-01T01:25:48.599007Z": 58.707279175196526, "2020-01-01T01:26:12.536642Z": null, "2020-01-01T01:26:36.478513Z": null, "2020-01-01T01:27:00.424621Z": null, "2020-01-01T01:27:24.374964Z": null, "2020-01-01T01:27:48.321071Z": null, "2020-01-01T01:28:12.262943Z": null, "2020-01-01T01:28:36.213286Z": null, "2020-01-01T01:29:00.167865Z": null, "2020-01-01T01:29:24.118207Z": null, "2020-01-02T00:26:59.463817Z": null, "2020-01-02T00:27:23.392980Z": null}, "geometry": {"type": "Polygon", "coordinates": [[[127.34114528888952, -22.348212816510664], [127.34033947641352, -22.348041851376717], [127.53378227636911, -21.55199643279669], [127.73094203859402, -20.733928184841567], [127.75777254753115, -20.622758899852183], [127.75848636334993, -20.62288384344786], [127.75870868691734, -20.622697870156575], [128.84983760949808, -20.849825432983085], [129.55323445468215, -20.992145758118575], [129.55465399864528, -20.9925011906876], [129.5549248317188, -20.992555401943296], [129.55492556266182, -20.992569184703267], [129.5560505751363, -20.992850859263285], [129.55310934955332, -21.00653785872775], [129.16215311397497, -22.7169482119524], [129.16098940577558, -22.721967341686792], [129.16055678413775, -22.72301896007316], [129.1590646150567, -22.72272080261975], [129.15794300955824, -22.722813041376664], [129.15238659801705, -22.721733511262162], [127.3463026082214, -22.349654647472928], [127.34113796054287, -22.348253240710296], [127.34114528888952, -22.348212816510664]]]}}, {"id": "106076", "type": "Feature", "properties": {"2020-01-01T01:22:37.127576Z": null, "2020-01-01T01:23:01.056739Z": null, "2020-01-01T01:23:24.985903Z": null, "2020-01-01T01:23:48.919302Z": null, "2020-01-01T01:24:12.852702Z": null, "2020-01-01T01:24:36.790337Z": null, "2020-01-01T01:25:00.723735Z": null, "2020-01-01T01:25:24.661371Z": null, "2020-01-01T01:25:48.599007Z": null, "2020-01-01T01:26:12.536642Z": 90.97827204874245, "2020-01-01T01:26:36.478513Z": null, "2020-01-01T01:27:00.424621Z": null, "2020-01-01T01:27:24.374964Z": null, "2020-01-01T01:27:48.321071Z": null, "2020-01-01T01:28:12.262943Z": null, "2020-01-01T01:28:36.213286Z": null, "2020-01-01T01:29:00.167865Z": null, "2020-01-01T01:29:24.118207Z": null, "2020-01-02T00:26:59.463817Z": null, "2020-01-02T00:27:23.392980Z": null}, "geometry": {"type": "Polygon", "coordinates": [[[126.98642815793356, -23.787417240436994], [126.98576366253165, -23.787276835263736], [126.9858517021366, -23.786045157607916], [127.0756320070483, -23.423401692025163], [127.16002465643142, -23.08186853072201], [127.32763717863409, -22.399767989121404], [127.4084502965044, -22.068665029808106], [127.40996065264466, -22.063289147428105], [127.41069718503257, -22.063444282238244], [127.41075919857425, -22.063364646733827], [129.2128293530146, -22.431960092692993], [129.2236287608398, -22.43411570097817], [129.22484410809412, -22.434546353335264], [129.2257042628138, -22.43471774600892], [129.22683943137775, -22.435119460191604], [128.82635611136965, -24.163904725911475], [128.82471852919613, -24.163839633259133], [128.82330794886622, -24.163560601999684], [128.82122014378703, -24.163358759185645], [128.77575160451974, -24.154356191409487], [127.00299992528518, -23.791233461458624], [126.986428539245, -23.787423623818842], [126.98642815793356, -23.787417240436994]]]}}, {"id": "106077", "type": "Feature", "properties": {"2020-01-01T01:22:37.127576Z": null, "2020-01-01T01:23:01.056739Z": null, "2020-01-01T01:23:24.985903Z": null, "2020-01-01T01:23:48.919302Z": null, "2020-01-01T01:24:12.852702Z": null, "2020-01-01T01:24:36.790337Z": null, "2020-01-01T01:25:00.723735Z": null, "2020-01-01T01:25:24.661371Z": null, "2020-01-01T01:25:48.599007Z": null, "2020-01-01T01:26:12.536642Z": null, "2020-01-01T01:26:36.478513Z": 51.76097217560933, "2020-01-01T01:27:00.424621Z": null, "2020-01-01T01:27:24.374964Z": null, "2020-01-01T01:27:48.321071Z": null, "2020-01-01T01:28:12.262943Z": null, "2020-01-01T01:28:36.213286Z": null, "2020-01-01T01:29:00.167865Z": null, "2020-01-01T01:29:24.118207Z": null, "2020-01-02T00:26:59.463817Z": null, "2020-01-02T00:27:23.392980Z": null}, "geometry": {"type": "Polygon", "coordinates": [[[128.4830734362999, -25.603982417885124], [128.47465680914965, -25.602548815009257], [126.6262101486508, -25.22653663161378], [126.62539416885063, -25.22613260133475], [126.62498417007059, -25.22604576381197], [126.62442647537591, -25.225769244267987], [126.73311672882598, -24.795259999575375], [126.84043327527253, -24.36800242127999], [126.9457940787507, -23.946405136699195], [127.0561171179157, -23.502962509544826], [127.05801691761354, -23.503361040948743], [127.06269752128252, -23.50406627197822], [128.8830296310101, -23.874307523268705], [128.88889139953113, -23.875664855303064], [128.89264846826404, -23.876411781382124], [128.8932056307203, -23.876679915287173], [128.48716759785052, -25.60462377885277], [128.48670392091807, -25.604694079509695], [128.4830734362999, -25.603982417885124]]]}}, {"id": "106078", "type": "Feature", "properties": {"2020-01-01T01:22:37.127576Z": null, "2020-01-01T01:23:01.056739Z": null, "2020-01-01T01:23:24.985903Z": null, "2020-01-01T01:23:48.919302Z": null, "2020-01-01T01:24:12.852702Z": null, "2020-01-01T01:24:36.790337Z": null, "2020-01-01T01:25:00.723735Z": null, "2020-01-01T01:25:24.661371Z": null, "2020-01-01T01:25:48.599007Z": null, "2020-01-01T01:26:12.536642Z": null, "2020-01-01T01:26:36.478513Z": null, "2020-01-01T01:27:00.424621Z": 2.906772680693301, "2020-01-01T01:27:24.374964Z": null, "2020-01-01T01:27:48.321071Z": null, "2020-01-01T01:28:12.262943Z": null, "2020-01-01T01:28:36.213286Z": null, "2020-01-01T01:29:00.167865Z": null, "2020-01-01T01:29:24.118207Z": null, "2020-01-02T00:26:59.463817Z": null, "2020-01-02T00:27:23.392980Z": null}, "geometry": {"type": "Polygon", "coordinates": [[[126.2571142497158, -26.66374788705592], [126.25642359409419, -26.66360335144358], [126.26905890636172, -26.61387744785672], [126.35482330278768, -26.28117982680821], [126.50491719115108, -25.69542242489204], [126.67431367060966, -25.028320800210917], [126.69565298611316, -24.943895376250943], [126.69627322603831, -24.94230858461836], [126.69703757686236, -24.942390221151058], [126.69709100308077, -24.942253533516755], [128.55083225419625, -25.316732812230573], [128.55395869065444, -25.317628549138064], [128.55396004469281, -25.31764717781112], [128.55501372824986, -25.317891033350428], [128.14323283054543, -27.04476701546884], [128.14217671233075, -27.044561350887943], [128.14209912443016, -27.04469239880914], [126.25709629034706, -26.66381936038643], [126.2571142497158, -26.66374788705592]]]}}, {"id": "106079", "type": "Feature", "properties": {"2020-01-01T01:22:37.127576Z": null, "2020-01-01T01:23:01.056739Z": null, "2020-01-01T01:23:24.985903Z": null, "2020-01-01T01:23:48.919302Z": null, "2020-01-01T01:24:12.852702Z": null, "2020-01-01T01:24:36.790337Z": null, "2020-01-01T01:25:00.723735Z": null, "2020-01-01T01:25:24.661371Z": null, "2020-01-01T01:25:48.599007Z": null, "2020-01-01T01:26:12.536642Z": null, "2020-01-01T01:26:36.478513Z": null, "2020-01-01T01:27:00.424621Z": null, "2020-01-01T01:27:24.374964Z": 0.0, "2020-01-01T01:27:48.321071Z": null, "2020-01-01T01:28:12.262943Z": null, "2020-01-01T01:28:36.213286Z": null, "2020-01-01T01:29:00.167865Z": null, "2020-01-01T01:29:24.118207Z": null, "2020-01-02T00:26:59.463817Z": null, "2020-01-02T00:27:23.392980Z": null}, "geometry": {"type": "Polygon", "coordinates": [[[125.8815978430446, -28.10081023223811], [125.8814715179326, -28.100783809081943], [125.8809007751496, -28.100503131656023], [125.88109634922486, -28.099127172209197], [125.98498846969122, -27.70433094498851], [126.14220287670588, -27.103043053385562], [126.26889232419404, -26.614550955462082], [126.32629422697521, -26.392315946149694], [126.3292602220517, -26.381000401836907], [126.32956572479021, -26.380629413360133], [126.33022410284146, -26.380766286841894], [126.33024010255812, -26.380709675833025], [128.1983484720824, -26.755495525373824], [128.21124091471884, -26.758270630116037], [128.21123009595573, -26.75831599705301], [128.2120691938422, -26.75847837541494], [128.21174920266338, -26.7606709287185], [127.79369367645597, -28.484182430406232], [127.792622052959, -28.483975757770022], [127.79260969662117, -28.48402581072313], [125.88159404946401, -28.100828580125523], [125.8815978430446, -28.10081023223811]]]}}, {"id": "106080", "type": "Feature", "properties": {"2020-01-01T01:22:37.127576Z": null, "2020-01-01T01:23:01.056739Z": null, "2020-01-01T01:23:24.985903Z": null, "2020-01-01T01:23:48.919302Z": null, "2020-01-01T01:24:12.852702Z": null, "2020-01-01T01:24:36.790337Z": null, "2020-01-01T01:25:00.723735Z": null, "2020-01-01T01:25:24.661371Z": null, "2020-01-01T01:25:48.599007Z": null, "2020-01-01T01:26:12.536642Z": null, "2020-01-01T01:26:36.478513Z": null, "2020-01-01T01:27:00.424621Z": null, "2020-01-01T01:27:24.374964Z": null, "2020-01-01T01:27:48.321071Z": 0.0, "2020-01-01T01:28:12.262943Z": null, "2020-01-01T01:28:36.213286Z": null, "2020-01-01T01:29:00.167865Z": null, "2020-01-01T01:29:24.118207Z": null, "2020-01-02T00:26:59.463817Z": null, "2020-01-02T00:27:23.392980Z": null}, "geometry": {"type": "Polygon", "coordinates": [[[125.49803579515043, -29.53638527954869], [125.49723474636403, -29.536143677872268], [125.49933996770574, -29.52769109822313], [125.5643816272063, -29.286473056904146], [125.73037268128414, -28.66663231181407], [125.85469108379819, -28.198640161779554], [125.95537904583762, -27.817637043012212], [125.95609469755655, -27.8177850854751], [125.95621741527195, -27.817587889862743], [127.86277830802561, -28.197767000784598], [127.86276417225548, -28.197825320674944], [127.86385833815248, -28.198035138278346], [127.43930987336212, -29.918115499070623], [127.43831651345312, -29.922029003127264], [127.43800102023889, -29.922539224780962], [127.43663553283898, -29.92227838311532], [127.43228021969394, -29.92172139683128], [125.81094404063334, -29.60082989328373], [125.49884290337567, -29.53662870290104], [125.49827816203533, -29.536458377875807], [125.49803098848835, -29.536407171925028], [125.49803579515043, -29.53638527954869]]]}}, {"id": "106081", "type": "Feature", "properties": {"2020-01-01T01:22:37.127576Z": null, "2020-01-01T01:23:01.056739Z": null, "2020-01-01T01:23:24.985903Z": null, "2020-01-01T01:23:48.919302Z": null, "2020-01-01T01:24:12.852702Z": null, "2020-01-01T01:24:36.790337Z": null, "2020-01-01T01:25:00.723735Z": null, "2020-01-01T01:25:24.661371Z": null, "2020-01-01T01:25:48.599007Z": null, "2020-01-01T01:26:12.536642Z": null, "2020-01-01T01:26:36.478513Z": null, "2020-01-01T01:27:00.424621Z": null, "2020-01-01T01:27:24.374964Z": null, "2020-01-01T01:27:48.321071Z": null, "2020-01-01T01:28:12.262943Z": 0.21476448571705786, "2020-01-01T01:28:36.213286Z": null, "2020-01-01T01:29:00.167865Z": null, "2020-01-01T01:29:24.118207Z": null, "2020-01-02T00:26:59.463817Z": null, "2020-01-02T00:27:23.392980Z": null}, "geometry": {"type": "Polygon", "coordinates": [[[125.57426062837565, -29.253617323572325], [125.574349077143, -29.253550919296977], [127.24782625218738, -29.586494040926336], [127.4630523628978, -29.627640429033733], [127.50847202487036, -29.63628019757304], [127.50932060699473, -29.636597356375706], [127.50803601807824, -29.64252560969111], [127.07570850662171, -31.359571947585827], [127.07470861163341, -31.35939819703462], [127.07468529375065, -31.359488938633085], [127.06849413750818, -31.358318127767326], [127.06546468451197, -31.357791494769536], [126.72445717305958, -31.292746491223777], [125.11858025004285, -30.97340780990811], [125.10906578501938, -30.971227051612356], [125.10562687190973, -30.97051889279713], [125.10504198325852, -30.970233520551844], [125.2079210246769, -30.596979667630812], [125.37597767586401, -29.982560494967785], [125.53262484962868, -29.404133253727384], [125.57319061317257, -29.25369674772449], [125.57350375164874, -29.253461603047786], [125.57426062837565, -29.253617323572325]]]}}, {"id": "106082", "type": "Feature", "properties": {"2020-01-01T01:22:37.127576Z": null, "2020-01-01T01:23:01.056739Z": null, "2020-01-01T01:23:24.985903Z": null, "2020-01-01T01:23:48.919302Z": null, "2020-01-01T01:24:12.852702Z": null, "2020-01-01T01:24:36.790337Z": null, "2020-01-01T01:25:00.723735Z": null, "2020-01-01T01:25:24.661371Z": null, "2020-01-01T01:25:48.599007Z": null, "2020-01-01T01:26:12.536642Z": null, "2020-01-01T01:26:36.478513Z": null, "2020-01-01T01:27:00.424621Z": null, "2020-01-01T01:27:24.374964Z": null, "2020-01-01T01:27:48.321071Z": null, "2020-01-01T01:28:12.262943Z": null, "2020-01-01T01:28:36.213286Z": 2.089510249952543, "2020-01-01T01:29:00.167865Z": null, "2020-01-01T01:29:24.118207Z": null, "2020-01-02T00:26:59.463817Z": null, "2020-01-02T00:27:23.392980Z": null}, "geometry": {"type": "Polygon", "coordinates": [[[125.26356512032164, -32.517182999642806], [124.72584148152653, -32.40841365899793], [124.70358681792763, -32.40384594452415], [124.70314375200329, -32.40358572985473], [124.95019213664554, -31.52638144742032], [125.15489016709328, -30.78936217928579], [125.18285794602924, -30.688530492273475], [125.18354737537564, -30.68864563881605], [125.18356373255267, -30.688586277959285], [125.18520119784068, -30.68892183935181], [125.18729749319333, -30.68927190321178], [127.01082579799002, -31.04847859983504], [127.14776627850644, -31.074287134811104], [127.14820914302969, -31.074538937685443], [126.70588639727517, -32.79614640327312], [126.70475652665108, -32.79593516247178], [126.70472743629989, -32.79601754809538], [125.26356512032164, -32.517182999642806]]]}}, {"id": "106083", "type": "Feature", "properties": {"2020-01-01T01:22:37.127576Z": null, "2020-01-01T01:23:01.056739Z": null, "2020-01-01T01:23:24.985903Z": null, "2020-01-01T01:23:48.919302Z": null, "2020-01-01T01:24:12.852702Z": null, "2020-01-01T01:24:36.790337Z": null, "2020-01-01T01:25:00.723735Z": null, "2020-01-01T01:25:24.661371Z": null, "2020-01-01T01:25:48.599007Z": null, "2020-01-01T01:26:12.536642Z": null, "2020-01-01T01:26:36.478513Z": null, "2020-01-01T01:27:00.424621Z": null, "2020-01-01T01:27:24.374964Z": null, "2020-01-01T01:27:48.321071Z": null, "2020-01-01T01:28:12.262943Z": null, "2020-01-01T01:28:36.213286Z": null, "2020-01-01T01:29:00.167865Z": 5.6347921038279996, "2020-01-01T01:29:24.118207Z": null, "2020-01-02T00:26:59.463817Z": null, "2020-01-02T00:27:23.392980Z": null}, "geometry": {"type": "Polygon", "coordinates": [[[124.29199405071262, -33.836304288713116], [124.29138313053733, -33.83617969840487], [124.29093339463354, -33.83591815121987], [124.3762150184195, -33.54222577941503], [124.54246182418245, -32.965865224041416], [124.77565767754402, -32.14752314197299], [124.78250245747144, -32.12334426747147], [124.78295909876573, -32.122559912597815], [124.78615600532518, -32.12321101713672], [124.80003309470203, -32.12577680096279], [126.74674315943426, -32.505193985613204], [126.77793862852772, -32.511019540266304], [126.77874767639737, -32.51147440925369], [126.77988126679871, -32.51169600349565], [126.329232643493, -34.226732345416536], [126.32795548932708, -34.2314988531149], [126.32765004872024, -34.231879065560214], [126.32638876798609, -34.23164568803275], [126.3253656812196, -34.23172979309885], [124.60986428635145, -33.90080511663455], [124.29256527438815, -33.83663647852371], [124.29199405071262, -33.836304288713116]]]}}, {"id": "106084", "type": "Feature", "properties": {"2020-01-01T01:22:37.127576Z": null, "2020-01-01T01:23:01.056739Z": null, "2020-01-01T01:23:24.985903Z": null, "2020-01-01T01:23:48.919302Z": null, "2020-01-01T01:24:12.852702Z": null, "2020-01-01T01:24:36.790337Z": null, "2020-01-01T01:25:00.723735Z": null, "2020-01-01T01:25:24.661371Z": null, "2020-01-01T01:25:48.599007Z": null, "2020-01-01T01:26:12.536642Z": null, "2020-01-01T01:26:36.478513Z": null, "2020-01-01T01:27:00.424621Z": null, "2020-01-01T01:27:24.374964Z": null, "2020-01-01T01:27:48.321071Z": null, "2020-01-01T01:28:12.262943Z": null, "2020-01-01T01:28:36.213286Z": null, "2020-01-01T01:29:00.167865Z": null, "2020-01-01T01:29:24.118207Z": 3.2299473332710713, "2020-01-02T00:26:59.463817Z": null, "2020-01-02T00:27:23.392980Z": null}, "geometry": {"type": "Polygon", "coordinates": [[[123.86910180561922, -35.267021114348935], [123.86839113187737, -35.26687720618592], [123.86841175701664, -35.26680857290545], [123.86785969785855, -35.26663852984522], [123.90692775069489, -35.13570524051392], [124.12573636203525, -34.39915064570171], [124.36625916295402, -33.57683203902846], [124.37254418380144, -33.55525207329451], [124.37285809184203, -33.55501289166589], [124.37573301665002, -33.55559507817994], [124.38257935086402, -33.55673939872407], [125.99873597863721, -33.872266601585395], [126.39649541327681, -33.946223697993766], [126.40286879403, -33.94739944009135], [126.403325267554, -33.94765295974217], [126.40320256874472, -33.94877136206679], [125.94086269908544, -35.66621359502671], [125.93972441909526, -35.66616494542156], [125.93967373499528, -35.66634984231214], [124.07963933708314, -35.309446800624166], [123.86925928364856, -35.26706961834697], [123.86910180561922, -35.267021114348935]]]}}]}'
gdf_wide = gpd.read_file(geojson_data).set_index('id')
gdf_wide.plot(edgecolor='black')

# Basemap
basemap = {
    'url': 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
    'max_zoom': 19,
    'attribution': 'Map data (c) <a href="https://openstreetmap.org">OpenStreetMap</a> contributors',
    'name': 'OpenStreetMap.Mapnik'
}


# Animate
gdf_wide.plot_animated(filename='test.gif',
                       basemap_format={'source': basemap},
                       period_length=1000,
                       edgecolor='black')

Additional context pandas_alive version '0.2.4'

robbibt avatar Jul 22 '21 05:07 robbibt

Hmm this is an interesting problem, do you think the suggested solution should be optional or compulsory?

JackMcKew avatar Jul 22 '21 05:07 JackMcKew

Good question - I'd lean towards compulsory because we can already customise the shape of the plotting area/figure using the figsize param. Using the figsize area to define the basemap extent seems to make sense as it already provides its own flexibility (e.g. if a user did want a vertical/narrow area of basemap shown, they could request this with a custom figsize).

robbibt avatar Jul 22 '21 05:07 robbibt