Last active
April 29, 2016 13:04
-
-
Save vpipkt/778b6bfb50a6a141e7bcf610ea49b7f1 to your computer and use it in GitHub Desktop.
a sketch of a simple map in jupyter https://app.dominodatalab.com/r00sj3/jupyter/view/batchdemo.ipynb
This file contains 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
import pandas as pd | |
import folium | |
from matplotlib.colors import Normalize, rgb2hex | |
import matplotlib.cm as cm | |
data = pd.read_csv('http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.csv') | |
norm = Normalize(data['mag'].min(), data['mag'].max()) | |
map = folium.Map(location=[48, -102], zoom_start=3) | |
for eq in data.iterrows(): | |
color = rgb2hex(cm.OrRd(norm(float(eq[1]['mag'])))) | |
marker = folium.CircleMarker([eq[1]['latitude'], eq[1]['longitude']], | |
popup=eq[1]['place'], | |
radius=20000*float(eq[1]['mag']), | |
color=color, | |
fill_color=color) | |
map.add_children(marker) | |
map |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This will work and produce an inline map in jupyter notebook