I tried the ion() method and it works great for a small amount of data, but if you have large images or image streams in relatively fast, this method is terribly slow. As far as I understand, ion() will redraw everything every time you change your shape, including axes and labels, etc. Perhaps this is not the way you want.
This thread shows a much better way to do things.
Here is a simple example that I did showing how to do this:
import time import numpy import matplotlib.pyplot as plt fig = plt.figure( 1 ) ax = fig.add_subplot( 111 ) ax.set_title("My Title") im = ax.imshow( numpy.zeros( ( 256, 256, 3 ) ) )
I get about 30 FPS on my machine with the above code. When I run the same with plt.ion() and ax.imshow( data ) instead of im.axes.figure.canvas.draw() and im.set_data( data ) , I get about 1 FPS
Brent source share