Now the application displays two graphs with the same height:
CODE:
import sys
from PyQt5 import QtWidgets, uic
from PyQt5.QtWidgets import QListWidget, QVBoxLayout, QMainWindow
import pyqtgraph as pg
class Draw_interface(QMainWindow):
def __init__(self):
global time_update
super(Draw_interface, self).__init__()
uic.loadUi('charts.ui', self)
# Add two charts
self.my_draw = pg.GraphicsLayoutWidget(show=True)
self.p1 = self.my_draw.addPlot(row=0, col=0, stretch=3)
self.p2 = self.my_draw.addPlot(row=1, col=0, stretch=1)
# Set widget for chart
my_layout = QVBoxLayout()
my_layout.addWidget(self.my_draw)
self.frame_for_charts.setLayout(my_layout)
# Draw charts
y = [2.2, 3.0, 1.3, 2.5, 1.9, 2.2, 5.5, 6.6]
y2 = [2.3, 3.3, 2.8, 2.2, 3.3, 3.1, 2.8, 4.4]
curve1 = self.p1.plot(y)
curve2 = self.p2.plot(y2)
self.show()
my_app = QtWidgets.QApplication([])
my_main_window = Draw_interface()
sys.exit(my_app.exec_())
stretch=3 and stratch=1 - do not lead to the desired effect.
How to set the stretch factor correctly so that the upper graph is 75% of the height, the lower graph is 25% of the height? And it was like this:
Maybe:
self.my_draw.itemAt(0, 0).setGeometry(x1,y1,x2,y2)
self.my_draw.itemAt(0, 0).updateGeometry()
But this is clearly not the best option.



