I am trying to plot some points on the map, where the points are marked based on geo-coordinates and each point belongs to a category.
I am trying to set the color of the categories from the color array, and even converted that into a function, yet it is displaying all the categories in one color, as in the image:
Here's the code mentioned below. I am not exactly sure where am I going wrong, since this is from the documentation of Folium.
The variable 'c' here, is actually coming from the column C in dataframe, which has the number of the segment.
mapPlot = folium.Map(location=[latitude, longitude], zoom_start=2)
colors = [
'red',
'blue',
'gray',
'orange',
'beige',
'green',
'purple',
'cadetblue',
'black',
'pink'
]
def colorCall(val):
val = int(val)
return colors[val]
for lon, lat, c in zip(df1['long'], df1['lat'], df1['C']):
folium.CircleMarker(
[lat, lon],
radius=2,
#fill_color=colors[int(c)],
fill_color = colorCall(c),
fill=True,
fill_opacity=0.7
).add_to(mapPlot)
mapPlot