just a small tip for all who are creating many images by using something like this:
for param in range(10):
data = get_data(param)
fig = plt.figure()
ax = fig.add_subplot(111)
im = ax.imshow(data)
Unfortunately, even so the objects are created inside the loop, it seems they don't vanish completely from loop to loop. So, without the currently commented 'plt.close(fig)' you will create a huge memory leak (well, depending on your image sizes) that grinds even your 4GB Macbook Pro to a complete halt.
Hopefully that helps some people out.