Choropleth map from Geopandas GeoDataFame

十年热恋 提交于 2019-12-01 06:09:47

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:

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)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!