QgraphicsScene and matplotlib navigation toolbar
Luca Bertolotti
luca72.bertolotti at gmail.com
Tue May 11 17:14:54 BST 2021
Hello is possible to add the nabitoolbar to a scene
For add the graph i do as follow:
def test_draw(self):
scene = QGraphicsScene()
figure = Figure(figsize=(9.18, 6.25), dpi=55)
axes = figure.gca()
axes.set_title("Test Draw")
lista_r_mp = []
lista_y_mp = []
for a in range(len(lista_r)-1):
print(float(lista_r[a]), float(lista_r[a+1]))
test_r = np.linspace(float(lista_r[a]), float(lista_r[a+1]))
lista_r_mp.append(test_r)
for b in range(len(lista_y)-1):
test_y = np.linspace(float(lista_y[b]), float(lista_y[b+1]))
lista_y_mp.append(test_y)
for c in range(len(lista_y_mp)):
axes.plot(lista_r_mp[c], lista_y_mp[c])
axes.grid(True)
canvas = FigureCanvas(figure)
proxy_widget = scene.addWidget(canvas)
scene.addItem(proxy_widget)
self.graphicsView_2.setScene(scene)
How i can add navitoolbar i have try:
scene_one = QGraphicsScene()
canvas_1 = FigureCanvas(figure_1)
navigation = NavigationToolbar(canvas_1, self)
tabella = scene_one.addWidget(navigation)
scene_one.addItem(tabella)
self.graphicsView_2.setScene(scene)
self.graphicsView_3.setScene(scene_one)
but no toolbar is displaied
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210511/8acadc32/attachment.htm>
More information about the PyQt
mailing list