geopandas Explore 上的自定义图例颜色和间隔

Custom legend color and interval on geopandas explore

提问人:Dimas Rizqi 提问时间:10/17/2023 更新时间:10/17/2023 访问量:38

问:

我有一个名为 geodataframe,它由 3 个多边形组成:gdf_isochrone

    isochrone_id    travel_time_mins    geometry    furthest_distance   speed   category
0   is15    15  POLYGON ((106.77372 -6.23474, 106.77612 -6.234...   8901    35.604  0
1   is30    30  POLYGON ((106.74866 -6.21551, 106.75072 -6.214...   19130   38.260  1
2   is60    60  POLYGON ((106.67107 -6.21208, 106.67244 -6.207...   33835   33.835  2

我使用geopandas.explore来映射它,使用:

gdf_isochrone.explore(
    column = 'travel_time_mins',
    vmin = 0,
    vmax = 60,
    legend = True,
    tooltip = True
)

如何使颜色为:

travel_time_mins = 15, then green
travel_time_mins = 30, then yellow
travel_time_mins = 60, then red

我已经附上了现有的地图enter image description here

Python 熊猫 GIS Geopandas 分区统计

评论


答:

0赞 Anonymous 10/17/2023 #1

调整参数:https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoDataFrame.explore.htmlcmap

输入整个问题比阅读文档需要更多的时间。