Hi,
I have successfully used both pyqtgraph and matplotlib together in a data processing/analysis project. I used pyqtgraph for the most part, all the interactive plots etc, and then matplotlib for the final step of generating publication-quality plots. It's something I always wanted to open-source but never really sorted out the details for that, but I'll try to summarise here. Perhaps email me directly if you have problems and I may be able to sort out and supply some better code.
Imports look something like:
# Do usual Qt imports, pyqtgraph and matplotlib
from PyQt5 import QtWidgets, uic
import pyqtgraph as pg
import matplotlib as mpl
mpl.use('Qt5Agg')
# For matplotlib plots in the GUI
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
# For matplotlib plot exports to pdf
from matplotlib.backends.backend_pdf import FigureCanvasPdf, PdfPages
In relevant UI class, set up a matplotlib FigureCanvas widget to render onto:
self.resultplot_figureCanvas = FigureCanvas(mpl.figure.Figure(constrained_layout=True))
self.resultplots_groupBox.layout().addWidget(self.resultplot_figureCanvas)
In appropriate place, render matplotlib plot to the FigureCanvas instead of letting mpl.pyplot create one for you:
fig = self.resultplot_figureCanvas.figure
fig.clear()
ax = fig.subplots(1, 1)
ax.plot([1, 2, 3], [4, 5, 6])
#...
self.resultplot_figureCanvas.draw()
If you want to render to a pdf, then render to a FigureCanvasPdf something like:
canvas = FigureCanvasPdf(mpl.figure.Figure(constrained_layout=True, figsize=(figwidth, figheight)))
fig = canvas.figure
ax = fig.subplots(1, 1)
ax.plot([1, 2, 3], [4, 5, 6])
# ...
fig.savefig("filename.pdf", bbox_inches="tight", dpi=150, metadata=metadata_pdf)
The application is a little old now (Qt5 etc), but hopefully that might give you something to work with.
Patrick