-
Notifications
You must be signed in to change notification settings - Fork 0
/
vis.py
executable file
·25 lines (23 loc) · 888 Bytes
/
vis.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
import plotly as ply
import plotly.graph_objs as go
def plot_timeseries(x: list, y: list, legend: list, title='My Plot', filename='plot.html',
xaxis_title='X Axis', yaxis_title='Y Axis'):
data = []
for idx, tr in enumerate(x):
trace = go.Scatter(x=tr, y=y[idx], name=legend[idx])
data.append(trace)
layout = go.Layout(title=title,
xaxis=dict(
title=xaxis_title,
autorange=True,
showticklabels=True
),
yaxis=dict(
title=yaxis_title,
autorange=True,
showticklabels=True
))
ply.offline.plot({
'data': data,
'layout': layout
}, auto_open=False, filename=filename)