pyqtgraph设置y轴固定范围

class MainW(QMainWindow):
    def __init__(self, x_list, y_list):
        super(MainW, self).__init__()
        self.wdg = QWidget()
        self.wdg.resize(1000, 600)
        self.glt = QGridLayout()
        self.wdg.setLayout(self.glt)
        self.p3 = pg.PlotWidget(title='goo')
        pg.setConfigOptions(antialias=True)
        self.glt.addWidget(self.p3)
        self.curve = self.p3.plot(pen=QColor(88, 88, 88), name='y1')
        self.p3.setYRange(400, 800)                   # 设置y轴范围
        self.curve.setData(x_list, y_list)
        self.setCentralWidget(self.wdg)

显示结果:y轴从400到800

 

posted @ 2020-09-03 09:59  haozhang13  阅读(3510)  评论(0编辑  收藏  举报