动态更改地理图中显示的地理数据框列

问题描述 投票:2回答:1

我想知道是否可以动态更改Geopandas GeoDataFrame中的哪一列显示在地理图中。例如,如果我有一个带有不同列的GeoDataFrame,它们分别代表不同日期的全局数据,那么我该如何使用一个交互式滑块来让我在地理图中显示特定日期的数据?我看到matplotlib.widgets有一个滑块,但我不知道如何将其应用于GeoDataFrame和geoplot。

python pandas slider interactive geopandas
1个回答
0
投票
from ipywidgets import interact @interact(x=states.columns) def on_trait_change(x): states.plot(x)

ineractive state plot

© www.soinside.com 2019 - 2024. All rights reserved.