SetRange, Items, AutoRange : To keep only latest certain number of data on graph.
출처 : ????
from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
import pyqtgraph as pg
QtGui.QApplication([])
win = pg.GraphicsLayoutWidget(show=True, title="Plot auto-range examples")
win.resize(800,600)
win.setWindowTitle('pyqtgraph example: PlotAutoRange')
d = np.random.normal(size=100)
d[50:54] += 10
p1 = win.addPlot(title="95th percentile range", y=d)
p1.enableAutoRange('y', 0.95)
p2 = win.addPlot(title="Auto Pan Only")
p2.setAutoPan(y=True)
curve = p2.plot()
def update():
t = pg.time()
data = np.ones(100) * np.sin(t)
data[50:60] += np.sin(t)
global curve
curve.setData(data)
timer = QtCore.QTimer()
timer.timeout.connect(update)
timer.start(50)
if __name__ == '__main__':
import sys
if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
QtGui.QApplication.instance().exec_()
'PyQtGraph 공부.' 카테고리의 다른 글
Study 8 : Scatter Plotting (선 없이 점만 찍기) (0) | 2021.08.24 |
---|---|
Study 7 : ROI demo from original example (0) | 2021.08.24 |
Study 5 : 그래프 라이브러리 PyQtGraph 2D Graph 예제 코드 (0) | 2021.08.24 |
Study 4 : timeaxis 만들어, 최근 data 만 실시간 보여주기 (0) | 2021.08.24 |
Study 3 : pyqtgraph -- realtime chart 그리기 (0) | 2021.08.24 |