How can I make high-quality matplotlib animations and avoid blurry text/line rendering?

Viewed 1896

I'm trying to figure out how to make high-quality animations/illustrations in with the matplotlib.animations module. So far, however, they tend to have blurry text (sometimes severe, depending on the video size) and often strange artifacts in the conversion of various vector graphics to bitmap; an example made with the ImageMagick renderer is below.

Example gif

You'll notice the square boxes have jagged lines, and while in this example the title fared okay, other times it can be pretty mangled.

What settings can I tweak to make these animations higher-quality?

1 Answers

A few paramters that you should care about:

Writer = animation.writers['ffmpeg']
writer = Writer(fps=15, metadata={artist:'O'}, bitrate=900) #<-- increase bitrate

fig = plt.figure(figsize=(8,8),dpi=900) # <-- increase dpi
.
.
.
anim.save(SavePath + 'D6666D9600XZ.mov', writer=writer,dpi=900) #<-- increase dpi
Related