#!/usr/bin/env python import numpy as np import time import matplotlib #matplotlib.use('GTKAgg') from matplotlib import pyplot as plt plt.style.use('bmh') plt.ion() ## Note this correction fig=plt.figure() i=0 x=list() yd=list() y=list() while i <1000: temp_y=np.loadtxt("/sys/class/thermal/thermal_zone0/temp")/1000 x.append(i); y.append(temp_y); try: t = y[-1] for deg in range(4): t += yd[deg-1] t /=2 yd.append(t) except: yd.append(temp_y) plt.clf() plt.plot(x,yd); i+=1; plt.xlim([i-500, i]) plt.show() plt.pause(.05) #Note this correction