import serial import matplotlib.pyplot as plt ser = serial.Serial("COM3", 9600) num_values = int(input("kolik dat načíst?")) values = [] while True: for i in range(num_values): line = ser.readline().decode("utf-8").strip() name, value = line.split(":") values.append(int(value)) print(i) plt.plot(values) plt.show() values = [] if input("q?") == "q": break