Skip to content

Instantly share code, notes, and snippets.

Created February 12, 2014 23:02
Show Gist options
  • Save anonymous/8966321 to your computer and use it in GitHub Desktop.
Save anonymous/8966321 to your computer and use it in GitHub Desktop.
pyqtgraph prolbem
## Create window with two ImageView widgets
win = QtGui.QMainWindow()
win.resize(800,800)
win.setWindowTitle('pyqtgraph example: DataSlicing')
cw = QtGui.QWidget()
win.setCentralWidget(cw)
l = QtGui.QGridLayout()
cw.setLayout(l)
dummy_plot= pg.PlotItem(title='Pilatus image')
dummy_plot.enableAutoRange()
imv1 = pg.ImageView(view=dummy_plot )
# imv1 = pg.ImageView()
pw = pg.PlotWidget()
pw2 = pg.PlotWidget()
pw3 = pg.PlotWidget()
# imv2 = pg.ImageView()
l.addWidget(imv1, 0, 0)
l.addWidget(pw, 1, 0)
l.addWidget(pw2, 2, 0)
win.show()
roi = pg.LineSegmentROI([[10, 64], [120,64]], pen='r')
imv1.addItem(roi)
data = data_array
def update():
global data, imv1, pw, roi
pw.clear()
pw2.clear()
d2 = roi.getArrayRegion(data_array, imv1.imageItem, axes=(1,2))
pw.plot(d2[0],pen=roi.pen)
pw2.plot(d2[1],pen = [5,8])
roi.sigRegionChanged.connect(update)
imv1.setImage(data_array, xvals=data_df.Time )#, axes= {'t':2, 'x':0, 'y':1, 'c':3},transform=)
update()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment