Choropleth map from Geopandas GeoDataFame

后端 未结 2 1433
礼貌的吻别
礼貌的吻别 2021-01-12 16:15

I\'m trying to make a choropleth map from polygons in a Geopandas GeoDataFrame. I want to symbolize the polygons by quantiles of a value in one of the GeoDataFrame columns.

相关标签:
2条回答
  • 2021-01-12 16:42

    The below patch is integrated in geopandas, so you can do now just:

    tracts.plot(column='CRIME', scheme='QUANTILES', k=3, colormap='OrRd', legend=True)
    

    I made a small patch to the plot_dataframe function of geopandas to enable a legend when using a PySAL scheme. You can find it here: http://nbviewer.ipython.org/gist/jorisvandenbossche/d4e6efedfa1e4e91ab65 (the adjustment is only in the few lines after if scheme is not None:).

    This lets you do the following:

    ax = plot_dataframe(tracts, column='CRIME', scheme='QUANTILES', k=3, colormap='OrRd', legend=True)
    

    to get such a figure:

    0 讨论(0)
  • 2021-01-12 16:59

    To adjust the polygon outline width, you can use "linewidth" like so:

    tracts.plot(column='CRIME', scheme='QUANTILES', k=3, colormap='OrRd', linewidth=0.1)
    
    0 讨论(0)
提交回复
热议问题