Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PyQt5 import QtWidgets as qtw
- from PyQt5 import QtCore as qtc
- from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg
- from matplotlib.figure import Figure
- # Импорты которые надо добавить в начало
- def draw_some(plot):
- fig = Figure(figsize=(5, 5))
- #can = FigureCanvasQTAgg(fig)
- #.toolbar = NavigationToolbar2QT(can, self)
- #layout = qtw.QVBoxLayout(self)
- #layout.addWidget(toolbar)
- #layout.addWidget(can)fig = Figure(figsize=(5, 5))
- fig = Figure(figsize=(5, 5))
- can = FigureCanvasQTAgg(fig)
- layout = qtw.QVBoxLayout(plot)
- layout.addWidget(can)
- # here you can set up your figure/axis
- ax = can.figure.add_subplot(111)
- # plot a basic line plot from x and y values.
- ax.cla() # clears the axis
- # тут твоё гавно
- X, Y = (10, 20), (10, 20)
- ax.plot(X, Y )
- ax.grid(True)
- can.figure.tight_layout()
- can.draw()
- app = qtw.QApplication([])
- qt_app = qtw.QWidget()
- layout = qtw.QVBoxLayout(qt_app)
- plot = qtw.QWidget()
- layout.addWidget( plot )
- qt_app.setLayout( layout )
- draw_some( plot )
- qt_app.show()
- app.exec_()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement