How can I set the resolution of an animation saved as an mp4 movie using the matplotlib.animation module?
I found examples on the Internet using "animation.FuncAnimation". For example, a good tutorial from http://jakevdp.github.com/blog/2012/08/18/matplotlib-animation-tutorial/ :
anim = animation.FuncAnimation(fig, animate, init_func=init, frames=200, interval=20, blit=True) anim.save('basic_animation.mp4', fps=30, extra_args=['-vcodec', 'libx264'])
From the matplotlib.animation module link, I found the "animation.Animation.save" method that provides the "dpi" argument, but I donβt know how to use this function correctly.
matplotlib.animation.Animation.save(filename, writer=None, fps=None, dpi=None, codec=None, bitrate=None, extra_args=None, metadata=None, extra_anim=None)
A small sample code may be helpful.
Many thanks.
Johannes
PS: By the way, how can you insert python code with sytax highlighting?
matplotlib animation
mr_endres
source share