# You need to setup a signal slot mechanism, to
# send data to your GUI in a thread-safe way.
# Believe me, if you don't do this right, things
# go very very wrong..
class Communicate(QtCore.QObject):
data_signal = QtCore.pyqtSignal(float)

# You need to setup a signal slot mechanism, to
# send data to your GUI in a thread-safe way.
# Believe me, if you don't do this right, things
# go very very wrong..
class Communicate(QObject):
data_signal = pyqtSignal(float)

The code runs just fine. The animated graph is displayed on my screen, and it runs smoothly. But when I close the GUI, python won't exit. It just hangs. As I always start my python programs from a Windows cmd shell, I hit the

Ctrl-C

buttons to kill the process. But that doesn't help either. I have to close the cmd shell completely to kill the Python process.

EDIT :

Apparently matplotlib 1.5 is compatible with PyQt5 (thank you Mr. Tacaswell to point that out). My main reason to stick to matplotlib v2 was the use of PyQt5. This argument holds no longer, so I decided to downgrade matplotlib to 1.5. I did a clean re-installation of anaconda to go back to matplotlib 1.5.3, and wipe out all traces from matplotlib 2.0.0b. My system is now as follows:

OS: Windows 10 64-bit

python: 3.5.2 |Anaconda custom (64-bit)|

pyqt4:

Qt version: 4.8.7

SIP version: 4.18.1

PyQt version: 4.11.4

pyqt5:

Qt version: 5.7.0

SIP version: 4.18.1

PyQt version: 5.7

matplotlib: 1.5.3

TEST 1: Live graph with matplotlib 1.5.3 and PyQt4

I just run the code that I've given above - based on PyQt4. The live graph plots smoothly. But closing down the GUI is not enough to entirely stop the python process. There is still some zombie process running on the background. I have to dive into the Windows Task manager to kill it. Only after doing that, the cmd shell prompts again for new input. So, the problem is still the same. I am a bit puzzled, because I do remember that this code worked just fine on matplotlib 1.5 and PyQt4.