Question

I have an animation job that takes a long time and a lot of memory. I want to submit it to a TORQUE queue, but I can't use X on those machines. Since "default" matplotlib requires X, I need to import it like this:

import matplotlib
matplotlib.use("AGG")
import matplotlib.pyplot as plt
...

What's passed to the use() method is called a backend. The documentation on backends can be found here.

Which backend should I use if I'm using matplotlib.animate() and want to save the animation as an mp4 or theora?

Était-ce utile?

La solution

The saving of movies is handled by the writer objects in the animation module and have nothing to do with the backend you set using use. If you need to run your script without X then setting use('Agg') is the correct thing to do.

See Generating movie from python without saving individual frames to files and the animation.writer module attribute (which is a registry of the writers matplotlib found on your system).

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top