In [79]:
import numpy as np
import plotly.offline as py
import plotly.graph_objs as go
py.init_notebook_mode()
In [80]:
points = np.random.multivariate_normal(np.zeros(3), np.diag((1, 10, 5)), 200)
In [81]:
def visualize(name, data):
traces = []
for d in data:
traces.append(go.Scatter3d(
x=d["points"][:, 0],
y=d["points"][:, 1],
z=d["points"][:, 2],
mode='markers',
marker=dict(
color=d["color"],
size=d["size"]
)
))
layout = go.Layout(
margin=dict(
l=0,
r=0,
b=0,
t=0
),
scene=dict(
aspectmode='data'
)
)
fig = go.Figure(data=traces, layout=layout)
py.iplot(fig, filename='3d-scatter')
In [82]:
data = []
data.append(
dict(
points=points,
color='rgba(0,0,0,1)',
size=1
))
In [83]:
visualize('test', data)