Interactive mode broken in Qt4Agg backend? #1646

ycopin opened this Issue Jan 9, 2013 · 5 comments


None yet

3 participants

ycopin commented Jan 9, 2013

I used to make animated figures generated with scripts similar to the following one:

#!/usr/bin/env python

import numpy as N
import time

import matplotlib
matplotlib.use("Qt4Agg") # Not working
#matplotlib.use("WXAgg") # Buggy
#matplotlib.use("GTKAgg") # OK

import matplotlib.pyplot as P


fig,ax = P.subplots()

x = N.linspace(0,20)
line, = ax.plot(x, N.sin(x))

for i in range(25):
    print i
    line.set_data(x, N.sin(x+i))

It works fine with GTKAgg backend, but does not work with QT4Agg one: the figure just flashes at the end of the animation!

Is it a bug in Qt4Agg, or an unimplemented feature? Is there any way other than switching back to GTKAgg specifically?

PS: I know about the recent Animation module, but I don't want to update all my scripts to this new framework.


I believe this is the same issue as #1451 and I can confirm that using plt.pause rather than plt.draw and time.sleep resolved the issue in the QT4 backend. Both work fine in the GTK backend.

ycopin commented Jan 9, 2013

Indeed it does work with pyplot.pause in place of pyplot.draw, even though it generates a DeprecationWarning: DeprecationWarning: Using default event loop until function specific to this GUI is implemented

But is it a workaround of a true Qt4Agg backend bug, and a deeper change in the matplotlib API? In the later case, what is the utility of draw in interactive mode?


From and the documentation at I would say that warning is more of a issue with the qt4 backend not being complete and would not worry about it too much (but maybe fixing this should get it's own issue)


@ycopin I am going to close this as I think it is resolved. Ping me if you disagree.

@tacaswell tacaswell closed this Nov 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment