Using blit=True in matplotlib.animation

Please keep discussion on the list.

That warning means some thing is importing pyplot before your file. You need to make sure that you use matplotlib.use before anything in your process import pyplot.

You may need to change your matplotlibrc file.



On Sun, May 31, 2015, 00:30 Peter Rowat <peter@…4612…> wrote:

My file starts:
import numpy as np

import matplotlib


import matplotlib.pyplot as plt

import matplotlib.animation as animation

and the animation works, with blit=False, but with this message:


/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/ UserWarning: This call to matplotlib.use() has no effect

because the backend has already been chosen;

matplotlib.use() must be called before pylab, matplotlib.pyplot,

or matplotlib.backends is imported for the first time.



So I can live with this, but seems there is something not quite right about the code

Should I use a different backed than the OS X backend?

— Peter

On May 30, 2015, at 8:43 PM, Thomas Caswell <tcaswell@…287…> wrote:

Blitting not working for the osx backend is a long standing issue due to differences between what is allowed in the different gui frame works.

You have to change the backend via use before you import pyplot. If you are still getting the error it is likely you tried to change the backend after pyplot was imported, in which case the use command does nothing.


On Sat, May 30, 2015 at 11:03 PM Peter Rowat <peter@…4612…> wrote:

I’m on OS X, trying to write a multi-slider-controlled animation. If I have blit=True in the call to matplotlib.animation,
I get this message

matplotlib.animation.BackendError: The current backend is ‘MacOSX’

and may go into an infinite loop with blit turned on. Either

turn off blit or use an alternate backend, for example, like

‘TKAgg’, using the following prepended to your source code:

import matplotlib



When I make this change I still get the same error message, whether blit is set True or False.

At least when blit=False the animation runs, which I can live with for the moment.

Matplotlib-users mailing list