'Plotting in widget on ui with PySide6

I need to plot on the predefined part of the ui with PySide6. The ui is designed with Qt Creator and it contains a widget called "widgetGraph". If I'm using the following example it works, but due to the set of the central widget everything on the ui gets overwritten

self.ui.widgetGraph = pyqtgraph.PlotWidget()
self.ui.setCentralWidget(self.ui.widgetGraph)

hour = [1,2,3,4,5,6,7,8,9,10]
temperature = [30,32,34,32,33,31,29,32,35,45]

# plot data: x, y values
self.ui.widgetGraph.plot(hour, temperature)

Without using the "setCentralWidget" function the widget remains empty. Is there any way not to override the ui elements, just plot into the previously mentioned "widgetGraph" widget?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source