Passing None as an argument to subplots_adjust does not do what you think the (doc) is doing. This means "use default value." To do what you want, use the following instead:
fig.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=None, hspace=None)
You can also make your code much more efficient if you reuse your ImageAxes object ImageAxes
mat = np.random.random((100,100)) im = ax.imshow(mat,interpolation='nearest') with writer.saving(fig, "writer_test.mp4", 100): for i in range(100): mat = np.random.random((100,100)) im.set_data(mat) writer.grab_frame()
By default, imshow fixes the proportions equal, i.e. your pixels are square. You need to resize the shape in the same way as your images:
fig.set_size_inches(w, h, forward=True)
or say imshow to use an arbitrary aspect ratio
im = ax.imshow(..., aspect='auto')
source share