Wrote here. However, I left it too much, so I repartitioned it ... Roughly summarize in the center of the code.
import sys
from PySide.QtCore import *
from PySide.QtGui import *
import pyqtgraph as pg
class GraphWindow(QMainWindow):
def __init__(self, parent = None):
super(GraphWindow, self).__init__(parent)
##1 Create a PlotWidget
pw = pg.PlotWidget()
##1 Set the widget in the window
self.setCentralWidget(pw)
##1 Call plotItem
p1 = pw.plotItem
##1 Draw a scatter plot and a line graph
p1.addItem(pg.PlotCurveItem(x = [0, 1, 2, 3 ,4],
y = [0, 1, 2, 3 ,4]))
p1.addItem(pg.ScatterPlotItem(x = [0, 1, 2, 3 ,4],
y = [4, 3, 2, 1, 0]))
if __name__ == '__main__':
#Create a Qt Application
app = QApplication(sys.argv)
#Create and display form
mainWin = GraphWindow()
mainWin.show()
#Start the main loop of Qt
sys.exit(app.exec_())
Recommended Posts