From 41bc951a1cf4ce7ea1eeabdcd7831dbfc113de56 Mon Sep 17 00:00:00 2001 From: Luke Campagnola <> Date: Sun, 22 Apr 2012 13:22:43 -0400 Subject: [PATCH] minor plotting example update --- examples/Plotting.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/examples/Plotting.py b/examples/Plotting.py index cb512503..f19c1493 100644 --- a/examples/Plotting.py +++ b/examples/Plotting.py @@ -83,10 +83,13 @@ p8.addItem(lr) p9 = win.addPlot(title="Zoom on selected region") p9.plot(data2) -def update(): - p9.setXRange(*lr.getRegion()) -lr.sigRegionChanged.connect(update) -update() +def updatePlot(): + p9.setXRange(*lr.getRegion(), padding=0) +def updateRegion(): + 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. import sys