11
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PyQtGraphでグラフを描写する その1 - 作図

Last updated at Posted at 2016-09-29

PyQtGraphについて

は、ここに書きました。が、放置しすぎたので仕切り直しで…。コード中心にざっくりまとめます。

その1 作図まで

1.png

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 PlotWidgetを作成する
        pw = pg.PlotWidget()

        ## 1 ウィンドウにウィジェットを設定する
        self.setCentralWidget(pw)

        ## 1 plotItemを呼び出す
        p1 = pw.plotItem

        ## 1 散布図と折れ線グラフを描写する
        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__':
    # Qt Applicationを作ります
    app = QApplication(sys.argv)
    # formを作成して表示します
    mainWin = GraphWindow()
    mainWin.show()
    # Qtのメインループを開始します
    sys.exit(app.exec_())
11
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?