Introduction
mlpyqtgraph enables matplotlib-like plotting with pyqtgraph in existing python programs.
It accomplishes this, by offering an interface very similar to matplotlib, while maintaining key pyqtgraph features such as speed and interactivity.
mlpyqtgraph diverts the existing python program into a dedicated thread, while using the main thread solely for plotting with pyqtgraph. This is a requirement of Qt: the Graphical User Interface (GUI) is required to run in the main thread (also known as the "GUI thread").
This is facilitated using the python package
pqthreads, which exposes class
interfaces from the main GUI Thread in another QThread
in Qt for Python
(PySide). In doing so, it facilitates
communication between the main (GUI) thread and a dedicated QThread
s as
offered by Qt for Python.
The following example illustrates how mlpyqtgraph can be used in an existing
python program defined in main
. The decorator takes care of diverting all code
within the function it decorates into a separate QThead
. mlpyqtgraph
functionality is only available inside the decorated function and any of the
function it calls.