-
Notifications
You must be signed in to change notification settings - Fork 1
/
04_plotly_19.py
50 lines (40 loc) · 1.27 KB
/
04_plotly_19.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Heatmaps
# allow visualization of 3 features
# Categorical or continuous features along the x and y axis to make up a grid, and then a 3rd continuous feature displayed through color
import plotly.offline as pyo
import plotly.graph_objs as go
from plotly import tools
import pandas as pd
df1 = pd.read_csv('data/2010SitkaAK.csv')
df2 = pd.read_csv('data/2010SantaBarbaraCA.csv')
df3 = pd.read_csv('data/2010YumaAZ.csv')
trace1 = go.Heatmap(
x=df1['DAY'],
y=df1['LST_TIME'],
z=df1['T_HR_AVG'].values.tolist(),
colorscale='Jet',
zmin=5,
zmax=40
)
trace2 = go.Heatmap(
x=df2['DAY'],
y=df2['LST_TIME'],
z=df2['T_HR_AVG'].values.tolist(),
colorscale='Jet',
zmin=5,
zmax=40
)
trace3 = go.Heatmap(
x=df3['DAY'],
y=df3['LST_TIME'],
z=df3['T_HR_AVG'].values.tolist(),
colorscale='Jet',
zmin=5,
zmax=40
)
fig = tools.make_subplots(rows=1, cols=3, subplot_titles=['Sitka AK', 'SB CA', 'Yuma AZ'], shared_yaxes=True)
fig.append_trace(trace1,1,1)
fig.append_trace(trace2,1,2)
fig.append_trace(trace3,1,3)
fig['layout'].update(title='Temps for 3 cities')
pyo.plot(fig, filename='04_plotly_19.html')