Hi guys,
Thanks for the nice work here!
I'm new here so I'm sorry if I'm missing something. Do we have, in the current version, any way to define specific color schemes for the choropleth, beyond those defined in the docsting of the function (BuGn, BuPu, GnBu, OrRd, PuBu, PuBuGn, PuRd, RdPu, YlGn, YlGnBu, YlOrBr, and YlOrRd)?
Assuming you're using v0.2.0 and the choropleth convenience method, you are indeed limited to the color_brewer schemes defined in https://github.com/python-visualization/folium/blob/v0.2.0/folium/utilities.py#L104
On the other hand, for maximum flexibility, if you create your choropleth via either the GeoJson or TopoJson classes, you can pass in your own instance of colormap.
For examples, have a look at the StepColormap and LinearColormap sections in http://nbviewer.jupyter.org/github/python-visualization/folium/blob/v0.2.0/examples/Colormaps.ipynb
Thanks @eddies!
Nice! Thanks @eddies!
It says that there is no module named colormap in folium.
Please see the updated notebook: https://nbviewer.jupyter.org/github/python-visualization/folium/blob/master/examples/Colormaps.ipynb
There are two ways to import the colormap classes:
branca.colormap import ColorMap, LinearColormap, StepColormapfrom folium import ColorMap, LinearColormap, StepColormapThank you!
I have another question: I have a folium.Choropleth and I want to pass a customised map with 10 different colors into the fill_color parameter. I am using a df that has values between 1 and 10 in one column and if there is for example a 2 it should be shown blue, for a 7 yellow and so on...
Hi!
I'd like to do the same thing, did you find a way?
Most helpful comment
Assuming you're using v0.2.0 and the
choroplethconvenience method, you are indeed limited to thecolor_brewerschemes defined in https://github.com/python-visualization/folium/blob/v0.2.0/folium/utilities.py#L104On the other hand, for maximum flexibility, if you create your choropleth via either the GeoJson or TopoJson classes, you can pass in your own instance of
colormap.For examples, have a look at the StepColormap and LinearColormap sections in http://nbviewer.jupyter.org/github/python-visualization/folium/blob/v0.2.0/examples/Colormaps.ipynb