I am playing with Folium a lot right now and its really great to have something so easy to use in Python. But their documentation is seriously behind, which I understand. So I have 2 questions.
map.simple_marker(each_coord, popup=v[0], marker_color='#FFFF00')
map.simple_marker(each_coord, popup=v[0], marker_color='yellow')
map.simple_marker(each_coord, popup=v[0], marker_color='Yellow')
They should all make the marker yellow, instead it stays default red. The only colors I can actually change to are red, green, and purple. In an example from the folium documentation it looks like we should be able to use html color codes:
folium.CircleMarker([45.5215, -122.6261],
radius=500,
popup='Laurelhurst Park',
color='#3186cc',
fill_color='#3186cc',
).add_to(map_2)
But it doesn't work for me. Hope someone knows a way around this because I need at least 12 different colors for my project.
FutureWarning: simple_marker is deprecated. Use add_children(Marker) instead
which I think might be related to why I can't get the colors to work. But their is nothing in any of the documentation or open discussions about how to use add_children
Maybe someone with knowledge can clarify?Thanks
There are two things that you can customize to change the appearance of a marker. First, you can change the icon of the marker, and second, you can change the shape of the marker. Folium gives the folium. Icon() class which can be used for creating custom icons for markers.
If you want to use Fontawesome icons, you put in the icon's name without the prefix (e.g. just "hamburger" without "fa-" in front), then add the prefix keyword argument for Fontawesome, which is fa . See this question as well.
Folium is a powerful Python library that helps you create several types of Leaflet maps. By default, Folium creates a map in a separate HTML file. Since Folium results are interactive, this library is very useful for dashboard building. You can also create inline Jupyter maps in Folium.
I had the same problem. Here are the colors that work for markers:
colors = [
'red',
'blue',
'gray',
'darkred',
'lightred',
'orange',
'beige',
'green',
'darkgreen',
'lightgreen',
'darkblue',
'lightblue',
'purple',
'darkpurple',
'pink',
'cadetblue',
'lightgray',
'black'
]
folium.Marker([lat, lon], popup=str(name)+': '+color+'-'+str(clname), icon=folium.Icon(color=color)).add_to(feature_group)
In Icon,parameter color is limited, but icon_color can use RBG. Like:
folium.Marker([lat, lon], popup=str(name)+': '+color+'-'+str(clname), icon=folium.Icon(color='black',icon_color='#FFFF00')).add_to(feature_group)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With