Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom color for each polygon #387

willhaslam opened this issue Jan 10, 2017 · 2 comments


Copy link

@willhaslam willhaslam commented Jan 10, 2017

No description provided.


This comment has been minimized.

Copy link

@willhaslam willhaslam commented Jan 10, 2017

After spending all day on this I figured it out I could just loop through my categories and set the facevalue and plot them that way

@willhaslam willhaslam closed this Jan 10, 2017

This comment has been minimized.

Copy link

@jorisvandenbossche jorisvandenbossche commented Jan 11, 2017

@willhaslam With geopandas master, you can actually use the plot_polygon_collection function (which is used by the .plot() method on a GeoDataFrame under the hood). Something like this then works:

from geopandas.plotting import plot_polygon_collection

fig, ax = plt.subplots()
plot_polygon_collection(ax, gdf['geometry'], gdf['colors'], plot_values=False)

Small example with this:

I think this is a nice example of when using the lower-level plotting functions in geopandas can be useful.
In principle it is also possible to add support for this in the GeoDataFrame.plot(..) method when you supply a list-like to colors=.. that has the same length as the number of values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.