-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotting.py
More file actions
30 lines (23 loc) · 798 Bytes
/
plotting.py
File metadata and controls
30 lines (23 loc) · 798 Bytes
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
__author__ = 'mFoxRU'
from itertools import izip
import matplotlib.pyplot as plot
import matplotlib.animation as anim
def animate(i, lines, stream):
datas = [list(x) for x in stream.data]
for line, data in izip(lines, datas):
line.set_data(xrange(len(data)), data)
return lines
def plotter(stream):
fig = plot.figure()
ax = plot.axes(xlim=(0, stream.lim), ylim=(0, 256))
lines = []
for chan in xrange(stream.channels):
line, = ax.plot([], [], label='Channel {0}'.format(chan+1))
lines.append(line)
plot.xlabel('Time')
plot.ylabel('Value')
plot.grid()
plot.legend(loc='upper right')
animus = anim.FuncAnimation(fig, animate,
fargs=(lines, stream), interval=10, blit=False)
plot.show()