This package implements a QtQuick backend for matplotlib. It started from maplotlib_qtquick_playground, written by Frédéric Collonval, but it has been updated to work with the current version (3.2.1) of matplotlib.
In order to use matplotlib plots with QtQuick, do the following:
- In your main.py, use
QtQml.qmlRegisterTypeto registerFigureCanvasQtQuickAggunder whichever name you want to use. - In your QML files, instantiate an object with the QML type defined above. Its
objectNameproperty specifies the name of the object that can be found in the QML engine. It can be retrieved in python withwin.findChild(QtCore.QObject, "spectFigure"), for example, where"spectFigure"is theobjectNamein this case. - One can then pass this object as needed. This is the FigureCanvasQtQuickAgg object. The figure can be found in its
figureproperty.
The test in the tests directory gives a simple example of how to use this package.
Please let me know if you have any suggestions or better ways I should do this.