Luke Davis
Luke Davis

Reputation: 2666

How can I avoid blurry text/line rendering in matplotlib animations?

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. Here's an example made with ImageMagick:

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?

Upvotes: 3

Views: 3027

Answers (1)

Oren
Oren

Reputation: 5359

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

Upvotes: 2

Related Questions