I cannot get a flat filled color when I use polygon_marker. Instead I get a gradient that comes from Leaflet-DVF I suppose.
But many times, I would prefer to display a flat color.
Another point, I have noticed on the use of the property fill_color from polygon_marker is that the filled color is not displayed when you embed your map in a notebook.
Here is an example tested with 0.1.5
import folium
print folium.__version__
from IPython.display import HTML, display
def inline_map(m):
if isinstance(m, folium.folium.Map):
m._build_map()
srcdoc = m.HTML.replace('"', '"')
embed = HTML('<iframe srcdoc="{}" '
'style="width: {}px; height: {}px; '
'border: none"></iframe>'.format(srcdoc, m.width, m.height))
else:
raise ValueError('{!r} is not a folium Map instance.')
return embed
map_5 = folium.Map(width=600, height=400, location=[45.5236, -122.6750], zoom_start=13)
map_5.polygon_marker(location=[45.5318, -122.6745], popup='Broadway Bridge',
line_color='red',
fill_color='blue', num_sides=8, radius=10, fill_opacity=1)
inline_map(map_5)

Inspecting the SVG I find a
fill="url(#gradeac640f5-53f0-6c37-ea2b-10d33cbc9aa0)"
whereas in a saved html with map_5.create_map(path="myfile.html"), I get a
fill='blue' as expected (event if it is a gradient that is finally displayed).

OK I get a solution after reading and testing https://github.com/python-visualization/folium/issues/135
on "How to use folium with iPython / Jupyter notebook".
from IPython.display import HTML, display
def inline_map(m):
if isinstance(m, folium.folium.Map):
m._build_map()
srcdoc = "data:text/html;base64," + m.HTML.encode('base64')
embed = HTML('<iframe src="{}" '
'style="width: {}px; height: {}px; '
'border: none"></iframe>'.format(srcdoc, m.width, m.height))
else:
raise ValueError('{!r} is not a folium Map instance.')
return embed
Using that inline_map function that encodes the src of the iframe in base64 allows correct filling colors for polygon markers.
I let this issue open because the problem remains with 0.1.6 branch.
Leaving the mapobject as the last line in the notebook to get a rich HTML displayed should display filled colors but it's not the case.
Ooops! I took me so long to answer that you found the solution :flushed:
I let this issue open because the problem remains with 0.1.6 branch.
Thanks! I will address that before the v0.1.6. (Now I am almost glad with the huge delay that release :wink:)
@PBrockmann this is fixed in master. I will push for a new release ASAP.
Cool. Thnks.
I have just mentionned folium in a promissing project on WMS. See https://github.com/sci-wms/sci-wms/issues/96
As written I would like to clarify why a "styles" option is needed. It should be "parameters" option. It comes from http://leafletjs.com/reference.html#tilelayer-wms
OpenLayers has a better interface where the "params" option is well defined and easy to use.
I saw that. I agree that sci-wms is a :+1: (right @kwilcox :smile_cat:)
We need to sort https://github.com/python-visualization/folium/pull/124 out too. I will open another issue for that. Thanks!
I am re-opening this. Let's port the bug fix to v.0.1.6.
Done in #234
I have just tested the 0.1.6 release but the bug is still there.
Am I missing something ?

Yep: https://github.com/python-visualization/folium/pull/237
To inline everything breaks more stuff than fixes it. The proper fix is in folium v0.2.0 which compartmentalizes the elements. Sorry, but if you can figure out a better way to fix this we can always release a v0.1.7.
Although I strongly recommend you to take a look at the unreleased v0.2.0. There lots of nice feature and improvements to come.
Ok I will switch to the v0.2.0 when released
Thks
Hello all,
This is not working properly in folium 0.11. We still get gradient colors in RegularPolygonMarker. CircleMarker works fine.
Thank you,
Patricio
@prodriguezciae I agree, any fix for this - it's quite annoying. 馃憤
Most helpful comment
Hello all,
This is not working properly in folium 0.11. We still get gradient colors in RegularPolygonMarker. CircleMarker works fine.
Thank you,
Patricio