Discussion:
[Matplotlib-users] Using blit=True in matplotlib.animation
Peter Rowat
2015-05-31 02:25:56 UTC
Permalink
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
matplotlib.use('TKAgg’)
=====

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.
Thomas Caswell
2015-05-31 03:43:18 UTC
Permalink
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.

Tom
Post by Peter Rowat
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
import matplotlib
matplotlib.use('TKAgg’)
=====
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
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Thomas Caswell
2015-06-01 02:34:06 UTC
Permalink
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.

Tom
import numpy as np
import matplotlib
matplotlib.use('TKAgg')
import matplotlib.pyplot as plt
import matplotlib.animation as animation
======
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.
warnings.warn(_use_error_msg)
=======
So I can live with this, but seems there is something not quite right
about the __init__.py code
Should I use a different backed than the OS X backend?
— Peter
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.
Tom
Post by Peter Rowat
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
import matplotlib
matplotlib.use('TKAgg’)
=====
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
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Loading...