Interactive Matplotlib

Normally, matplotlib will not show plots until you call pylab.show(). However, if you call pylab.ion() before plotting, matplotlib will show the window immediately. For best results, decorate (set title, axis labels, etc) after calling pylab.plot() or pylab.hist(). You should still call pylab.show() at the end of your code, otherwise python will not wait for you to close the graph windows before exiting.

Example code:

import pylab
import visual
pylab.ion()
 
xs = []
ys = []
for x in range(10):
    xs.append(x)
    ys.append(x**2)
    pylab.plot(xs, ys, 'b-o')
    visual.rate(1)
pylab.show()