Juyter Logo

Interactive Maps (ipynb)

Steve Purves
import pandas as pd
import altair as alt
alt.data_transformers.enable('default', max_rows=None)
import numpy as np
df = pd.read_csv('./lapalma.csv')
df['Datetime'] = (df['Date'] + ' ' + df['UTC time']).apply(pd.to_datetime, format='%Y-%m-%d %H:%M:%S')
df.head()
df['mag'] = 4
df['mag'] = df['mag'].pow(df['Magnitude'])
import plotly.express as px
# df = px.data.carshare()
fig = px.scatter_mapbox(df, lat="Latitude", lon="Longitude", color="Depth(km)", size="Magnitude",
                  color_continuous_scale=px.colors.cyclical.IceFire, size_max=10, zoom=10,
                  mapbox_style="carto-positron", width=900, height=800)
fig.update_traces(marker=dict())
fig.show()