-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotting.py
33 lines (29 loc) · 919 Bytes
/
plotting.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import altair as alt
import pandas as pd
from vega_datasets import data
def plot_wells(coords):
wells = pd.DataFrame(coords)
# Read in polygons from topojson
states = alt.topo_feature(data.us_10m.url, feature='states')
# US states background
background = alt.Chart(states).mark_geoshape(
fill='lightgray',
stroke='white'
).properties(
width=500,
height=300
).project('albersUsa')
# airport positions on background
points = alt.Chart(wells).mark_circle(
size=10,
color='steelblue'
).encode(
longitude='longitude:Q',
latitude='latitude:Q',
color=alt.Color('gradient:Q', scale=alt.Scale(scheme='inferno')),
tooltip=[
alt.Tooltip('depth:Q', title='Depth (m)'),
alt.Tooltip('gradient:Q', title='Gradient (°C/m)', format='0.3f')
]
)
return background + points