-
Notifications
You must be signed in to change notification settings - Fork 0
/
Script.py
57 lines (52 loc) · 945 Bytes
/
Script.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
51
52
53
54
55
56
57
#%%
#3D plotting
import plotly.plotly as py
import plotly.graph_objs as go
mdf = df.head(100)
x = mdf['insulin']
y = mdf['age']
z = mdf['bmi']
trace1 = go.Scatter3d(
x=x,
y=y,
z=z,
mode='markers',
marker=dict(
size=12,
line=dict(
color='rgba(217, 217, 217, 0.14)',
width=0.5
),
opacity=0.8
)
)
x2 = mdf['glucose_conc']
y2 = mdf['thickness']
z2 = mdf['diastolic_bp']
trace2 = go.Scatter3d(
x=x2,
y=y2,
z=z2,
mode='markers',
marker=dict(
color='rgb(255, 127, 39)',
size=12,
symbol='circle',
line=dict(
color='rgba(217, 217, 217, 0.14)',
width=0.5
),
opacity=0.9
)
)
data = [trace1, trace2]
layout = go.Layout(
margin=dict(
l=0,
r=0,
b=0,
t=0
)
)
fig = go.Figure(data=data, layout=layout)
py.iplot(fig, filename='3d-scatter')