working
This commit is contained in:
26
ploting.py
Normal file
26
ploting.py
Normal file
@ -0,0 +1,26 @@
|
||||
import matplotlib.pyplot as plt
|
||||
import queue
|
||||
|
||||
data_queue = queue.Queue()
|
||||
|
||||
x_data, y_data = [], []
|
||||
|
||||
fig, ax = plt.subplots()
|
||||
line, = ax.plot([], [], 'r-')
|
||||
|
||||
def init():
|
||||
ax.set_xlim(0, 100)
|
||||
ax.set_ylim(0, 10)
|
||||
return line,
|
||||
|
||||
def update(frame):
|
||||
# sprawdzamy, czy są nowe dane w kolejce
|
||||
while not data_queue.empty():
|
||||
value = data_queue.get()
|
||||
x_data.append(len(x_data))
|
||||
y_data.append(value)
|
||||
if len(x_data) > 100:
|
||||
x_data.pop(0)
|
||||
y_data.pop(0)
|
||||
line.set_data(x_data, y_data)
|
||||
return line,
|
||||
Reference in New Issue
Block a user