Created
          December 11, 2020 08:39 
        
      - 
      
- 
        Save betterdatascience/b62d809ceb4a6b4f18b959865b1358a0 to your computer and use it in GitHub Desktop. 
Revisions
- 
        betterdatascience created this gist Dec 11, 2020 .There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ def generate_color(magnitude): if magnitude <= 5: c_outline, c_fill = '#ffda79', '#ffda79' m_opacity, f_opacity = 0.2, 0.1 else: c_outline, c_fill = '#c0392b', '#e74c3c' m_opacity, f_opacity = 1, 1 return c_outline, c_fill, m_opacity, f_opacity def generate_popup(magnitude, depth): return f'''<strong>Magnitude:</strong> {magnitude}<br><strong>Depth:</strong> {depth} km''' quake_map = folium.Map( location=[-16.495477, 174.9663341], zoom_start=5, tiles='Stamen Terrain', width=1024, height=600 ) for _, row in df.iterrows(): c_outline, c_fill, m_opacity, f_opacity = generate_color(row['mag']) folium.CircleMarker( location=[row['lat'], row['long']], popup=generate_popup(row['mag'], row['depth']), color=c_outline, fill=True, fillColor=c_fill, opacity=m_opacity, fillOpacity=f_opacity, radius=(row['mag'] ** 2) / 3 ).add_to(quake_map) quake_map