Config and Parse Data


In [56]:
from plotly.offline import init_notebook_mode, iplot, plot
from plotly import tools
from plotly.graph_objs import Scatter, Figure, Layout
init_notebook_mode(connected=True)
from IPython.display import display, HTML



In [57]:
import json
with open('datalog.txt') as file:
    datalog = json.load(file)
    print('Data from: ' + datalog['timeStart'])


Data from: UTC: 2017-11-05-19:38:21

Plots


In [58]:
# Time signal
time = datalog['tLoopStart']

# Things we don't want to plot against time, like time itself
exclude = ['tLoopStart','timeStart']

# Get list of signals we do want to plot
signal_names = [name for name in datalog if name not in exclude]

# Make a list of scatter plots
plots = [Scatter(x = time, y = datalog[name], name = name) for name in signal_names]

# Create subplot grid
fig = tools.make_subplots(rows=len(signal_names), cols=1, print_grid=False)

# Add plots to the figure
for i, data in enumerate(plots):
    fig.append_trace(data, i+1, 1)

#Show the plots        
fig['layout'].update(height=1800)
iplot(fig)