#!/usr/bin/python3 import sys import matplotlib.pyplot as plt from numpy import * l = 15.5 x = arange(-l,l,.2) y = sin(x)/x plt.ion() fig,ax = plt.subplots() line, = ax.plot(x,y) plt.show() while True: data = sys.stdin.buffer.read(1) y += .01 line.set_ydata(y) fig.canvas.draw() # sys.stdout.write("r\n"+data)