Last active
September 28, 2019 18:18
-
-
Save vanessaaleung/1a59088878080fd92718528476653c8d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create map | |
map_clusters = folium.Map(location = [latitude, longitude], zoom_start = 11) | |
# set color scheme for the clusters | |
x = np.arange(kclusters) | |
ys = [i + x + (i * x) ** 2 for i in range(kclusters)] | |
colors_array = cm.rainbow(np.linspace(0, 1, len(ys))) | |
rainbow = [colors.rgb2hex(i) for i in colors_array] | |
# add markers to the map | |
markers_colors = [] | |
for lat, lon, poi, cluster in zip(sf_merged['Latitude'], sf_merged['Longitude'], sf_merged['Neighborhood'], sf_merged['Cluster Labels']): | |
label = folium.Popup(str(poi) + ' Cluster ' + str(cluster), parse_html=True) | |
folium.CircleMarker( | |
[lat, lon], | |
radius = 5, | |
popup = label, | |
color = rainbow[cluster - 1], | |
fill = True, | |
fill_color = rainbow[cluster - 1], | |
fill_opacity = 0.7).add_to(map_clusters) | |
map_clusters |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment