Достаточно близко, используя график рассеяния и вставляя Нет между каждым экземпляром OFF & ON.
import plotly
import plotly.graph_objs as go
plotly.offline.init_notebook_mode(connected=True)
screen_time = ['2018-06-05 12:11:10','2018-06-05 12:12:50',None,'2018-06-05 12:13:05','2018-06-05 12:14:50',None,
'2018-06-05 12:16:10','2018-06-05 12:16:56',None,'2018-06-05 12:17:05','2018-06-05 12:19:15']
screen_pos = [1,1,None]*4
wifi_time = ['2018-06-05 12:12:12','2018-06-05 12:12:50',None,'2018-06-05 12:13:12','2018-06-05 12:13:50',None,
'2018-06-05 12:15:10','2018-06-05 12:17:16',None,'2018-06-05 12:17:55','2018-06-05 12:18:15']
wifi_pos = [1.5,1.5,None]*4
trace1 = go.Scatter(
x = wifi_time,
y = wifi_pos,
name='WiFi',
mode = 'lines',
line=dict(
width=10,
),
connectgaps=False
)
trace2 = go.Scatter(
x = screen_time,
y = screen_pos,
name='screen',
mode = 'lines',
line=dict(
width=10,
),
connectgaps=False
)
data = [trace1,trace2]
layout = go.Layout(
title="Device Status",
yaxis=dict(
visible=False
),
)
fig = dict(data=data, layout=layout)
# Plot and embed in ipython notebook!
plotly.offline.iplot(fig, filename='basic-scatter')