#!/usr/bin/python import matplotlib.pyplot as plt import numpy as np def f(t): x=np.random.rand(1) y=np.random.rand(1) return x,y fig, pic = plt.subplots() pic.set_xlim(0,1) pic.set_ylim(0,1) for t in range(20): x,y = f(t) # optionally clear axes and reset limits # plt.cla() # pic.set_xlim(0,1) # pic.set_ylim(0,1) pic.plot(x, y, marker="s") pic.set_title(str(t)) plt.draw() plt.pause(0.1) plt.show()