Answer the question
In order to leave comments, you need to log in
How to make friends PyQt and matplotlib?
Hello!
I can’t figure it out myself, I just recently started programming.
I need to display in a GUI application a graph created in matplotlib.pyplot.pcolormesh, as well as several graphs from matplotlib.pyplot.plot and matplotlib.pyplot.polar (for visualizing the acoustic field). Graphs in one window on different widgets.
Tried to use QGraphicsView/QGraphicsScene, but didn't understand how to add QuadMesh as QGraphicsItem, tried to attach FigureCanvasQTAgg from matplotlib.backends.backend_qt4agg to QWidget, but somehow without success.
Here is part of the code. I can't figure out how to put the QuadMesh object inside. Through plt.show() it works, but in a new window.
self.fld_frame = QtGui.QWidget()
fplt = self.fld.fieldplt() # возвращает QuadMesh
self.fig = Figure()
self.fig.canvas = FigureCanvas(self.fig)
self.fig.canvas.setParent(self.ac_field) # ac_field - объект QGraphicsView
self.fig.canvas.draw()
Answer the question
In order to leave comments, you need to log in
About a year ago, having suffered for quite a long time with the integration of matplotlib into a PyQt application, I discovered the wonderful PyQtGraph library . Of the pluses, I can note a more convenient integration into the application and, which was important for me, the speed of work when displaying dynamic data.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question