Choropleth Map by Geopandas GeoDataFame

I am trying to make a choropleth map from polygons in a GeoDataFrame geodata. I want to symbolize polygons with quantiles of value in one of the GeoDataFrame columns. I am trying to figure out the various options and see what works best for my needs. Any advice on this would be greatly appreciated.

It looks like Geopandas has the ability to do this already: http://nbviewer.ipython.org/github/geopandas/geopandas/blob/master/examples/choropleths.ipynb

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

This works, although I cannot find much documentation. I would like to be able to add a legend that shows quantile cutoff values, but it seems that the Geopandas plot currently only allows legends based on categorical data. Does anyone have a job for this?

In addition, I would like to be able to customize the width of the outline of the polygon. Is it possible?

As an alternative, with which I played, polygon patches are used in matplotlib. It looks much more attractive, but seems to offer more customization options. If you need to go down this route to build a legend, I can follow another question and show my code.

Thanks for the help.

+4
source share
1 answer

The following patch is integrated in geodata, so now you can do the following:

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

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

This allows you to do the following:

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

to get this figure:

enter image description here

+13
source

All Articles