Skip to content

Commit 7c8abf4

Browse files
authored
Update folium_vincent_markers.py
The old code has been commented to show the changes.
1 parent f6c2d9f commit 7c8abf4

1 file changed

Lines changed: 22 additions & 9 deletions

File tree

examples/folium_vincent_markers.py

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
# Binned wind speeds for NOAA 46050.
1818
bins = range(0, 13, 1)
1919
cuts = pd.cut(NOAA_46050['wind_speed_cwind (m/s)'], bins)
20-
ws_binned = pd.value_counts(cuts).reindex(cuts.levels)
20+
#ws_binned = pd.value_counts(cuts).reindex(cuts.values.levels) # cuts is a series, so values should be accessed
21+
# and also levels have been depreciated
22+
ws_binned = pd.value_counts(cuts).reindex(cuts.values.categories)
2123

2224
# NOAA 46401 Wave Period.
2325
vis1 = vincent.Line(NOAA_46041['dominant_wave_period (s)'],
@@ -37,12 +39,23 @@
3739
vis3.to_json('vis3.json')
3840

3941
# Map all buoys.
40-
buoy_map = folium.Map(location=[46.3014, -123.7390], zoom_start=7,
41-
tiles='Stamen Terrain')
42-
buoy_map.polygon_marker(location=[47.3489, -124.708], fill_color='#43d9de',
43-
radius=12, popup=(vis1, 'vis1.json'))
44-
buoy_map.polygon_marker(location=[44.639, -124.5339], fill_color='#43d9de',
45-
radius=12, popup=(vis2, 'vis2.json'))
46-
buoy_map.polygon_marker(location=[46.216, -124.1280], fill_color='#43d9de',
47-
radius=12, popup=(vis3, 'vis3.json'))
42+
# buoy_map = folium.Map(location=[46.3014, -123.7390], zoom_start=7,
43+
# tiles='Stamen Terrain')
44+
# buoy_map.polygon_marker(location=[47.3489, -124.708], fill_color='#43d9de',
45+
# radius=12, popup=(vis1, 'vis1.json'))
46+
# buoy_map.polygon_marker(location=[44.639, -124.5339], fill_color='#43d9de',
47+
# radius=12, popup=(vis2, 'vis2.json'))
48+
# buoy_map.polygon_marker(location=[46.216, -124.1280], fill_color='#43d9de',
49+
# radius=12, popup=(vis3, 'vis3.json'))
50+
# buoy_map.save(outfile='NOAA_buoys.html')
51+
52+
# The example of Vincent/Vega Markers should be updated
53+
# https://github.com/python-visualization/folium
54+
buoy_map = folium.Map(location=[46.3014, -123.7390], zoom_start=7,tiles='Stamen Terrain')
55+
popup1 = folium.Popup(max_width=800,).add_child(folium.Vega(vis1, width=500, height=250))
56+
folium.RegularPolygonMarker([47.3489, -124.708],fill_color='#43d9de', radius=12, popup=popup1).add_to(buoy_map)
57+
popup2 = folium.Popup(max_width=800,).add_child(folium.Vega(vis2, width=500, height=250))
58+
folium.RegularPolygonMarker([44.639, -124.5339],fill_color='#43d9de', radius=12, popup=popup2).add_to(buoy_map)
59+
popup3 = folium.Popup(max_width=800,).add_child(folium.Vega(vis3, width=500, height=250))
60+
folium.RegularPolygonMarker([46.216, -124.1280],fill_color='#43d9de', radius=12, popup=popup3).add_to(buoy_map)
4861
buoy_map.save(outfile='NOAA_buoys.html')

0 commit comments

Comments
 (0)