Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.1k views
in Technique[技术] by (71.8m points)

在pyqt5 中用pyqtgraph 画图,结果只见title和轴显示正确,不见图形,问题出在哪?

在pyqt5 中用pyqtgraph 画图,结果只见title和轴显示正确,不见图形,问题出在哪?
其中主要代码如下,控件布置

    self.p = [None] * 4  #动态控件
    EWidget = QWidget()
    ELayout = QGridLayout()
    #self.ProgramSetLabel = QFrame("Programs:")
    self.graphWidget = pg.PlotWidget()
    self.win=pg.GraphicsWindow()
    self.p[0]=self.win.addPlot()
    self.p[1]=self.win.addPlot()
    self.win.nextRow()
    self.p[2]=self.win.addPlot()
    self.p[3]=self.win.addPlot()

    ELayout.addWidget(self.win,0,1)
    EWidget.setLayout(ELayout)
    self.tabWidget.addTab(EWidget, "E")
    
    
    画图
    
            self.p[i].plot(x, y) #,pen='r'
            self.p[i].showGrid(x=True,y=True, alpha=0.5)
            self.p[i].setTitle(code)
            ![image.png](/img/bVcKkNl)

题外话:
为了在pyqt5中完成多子图独立绘图,用matplotlib.figure已经完成我的任务,唯一不能接受的是matplotlib.figure绘图太慢,在我的电脑上,1000条折线耗时2秒多钟,所以只能找其他的绘图方法


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...