Animation imshow interpolation

I am creating an animation with a static imshow() object as the background. Within imshow(), I have interpolation=‘quadric’, but in the .gif file the background is “pixelated” and the interpolation is gone. Is it possible to keep the interpolation in my animation? I’ve also tried saving the interpolated image as a png and plotting that as the background, but it still gets pixelated in the saved file. Increasing the size/resolution also does not help.

My imshow command:


My save command:

writergif = animation.PillowWriter(fps=25,bitrate=20)‘animation.gif’, writer=writergif,dpi=50,savefig_kwargs={‘facecolor’:"#0d0d3d"})

Its hard to know what you mean by pixelated; how big is the figure, and how big is background_arr? At 50 dpi, you are going to see individual pixels. Maybe you want gouraud shading? In which case, you can use pcolormesh

I suspect that you may be having issues with the gif falling back to a limited color pallet which will cause similar colors to “collapse” to the same color and make slow gradients look pixelated.

I do not see an obvious way to thread configuration through to Pillow though…