The basic structure for a rapidly updating animated plot with Matplotlib, without using
is described below for
only takes effect on the CURRENT (most recently called) axes.
If updating multiple axes, call
draw() after each set of axes is modified.
Both examples assume:
from matplotlib.pyplot import figure, draw, pause # imgs is a N x X x Y image stack fg = figure() ax = fg.gca()
pause() statement time is too small, Matplotlib may not update the plot at all.
Consider your display may not be able to update faster than about
More examples with speed comparison showing that imshow is faster than pcolormesh generally.
h = ax.imshow(imgs) # set initial display dimensions for img in imgs: h.set_data(img) draw(), pause(1e-3)
h = ax.pcolormesh(imgs) # set initial display dimensions for img in imgs: h.set_array(img.ravel()) draw(), pause(1e-3)