-
Notifications
You must be signed in to change notification settings - Fork 1
/
plot.py
49 lines (43 loc) · 1.33 KB
/
plot.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
import plotly
import chart_studio.plotly as py
import plotly.graph_objs as go
import pandas as pd
'''Method to plot data on plotly. Used for debuggin and testing the module'''
def plotData(data, message='Data', s=None, e=None):
print("Plotting")
dataG= []
for key in data.columns.values:
if(key!="time"):
#if(key!="event"):
if(key=="current"):
dataG.append(go.Scatter(y=data[key][s:e],
x=data["time"][s:e],
yaxis='y2',
name=key))
else:
dataG.append(go.Scatter(y=data[key][s:e],
x=data["time"][s:e],
name=key))
layout = dict(
title=message,
width=1000,
height=450,
xaxis=dict(
rangeselector=dict(),
rangeslider=dict()
),
yaxis=dict(
title='0 to 1'
),
yaxis2=dict(
title='current',
overlaying='y',
side='right'
)
)
fig = dict(data=dataG, layout=layout)
plotly.offline.plot(fig, auto_open=True)
def plotFromFile(path):
frame=pd.read_table(path, delimiter=",")
plotData(frame)
#plotFromFile('RP-A_data/test_softCrashChair_LowestVelocities.csv.txt')