minor plotting example update

This commit is contained in:
Luke Campagnola 2012-04-22 13:22:43 -04:00
parent 537540382f
commit 41bc951a1c

View File

@ -83,10 +83,13 @@ p8.addItem(lr)
p9 = win.addPlot(title="Zoom on selected region") p9 = win.addPlot(title="Zoom on selected region")
p9.plot(data2) p9.plot(data2)
def update(): def updatePlot():
p9.setXRange(*lr.getRegion()) p9.setXRange(*lr.getRegion(), padding=0)
lr.sigRegionChanged.connect(update) def updateRegion():
update() lr.setRegion(p9.getViewBox().viewRange()[0])
lr.sigRegionChanged.connect(updatePlot)
p9.sigXRangeChanged.connect(updateRegion)
updatePlot()
## Start Qt event loop unless running in interactive mode or using pyside. ## Start Qt event loop unless running in interactive mode or using pyside.
import sys import sys