From e0c5ae1d0f3b4de0de5c66f9164ab609c375135a Mon Sep 17 00:00:00 2001 From: Mikhail Terekhov Date: Tue, 6 Jan 2015 16:21:29 -0500 Subject: [PATCH] PlotItem.addAvgCurve: pass through 'stepMode' Selecting "Plot Options"->"Average" and checking checkbox freezes KDE if the curve has stepMode=True. See examples/histogram.py as an example. --- pyqtgraph/graphicsItems/PlotItem/PlotItem.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pyqtgraph/graphicsItems/PlotItem/PlotItem.py b/pyqtgraph/graphicsItems/PlotItem/PlotItem.py index 2cfb803d..71f58910 100644 --- a/pyqtgraph/graphicsItems/PlotItem/PlotItem.py +++ b/pyqtgraph/graphicsItems/PlotItem/PlotItem.py @@ -471,12 +471,13 @@ class PlotItem(GraphicsWidget): ### Average data together (x, y) = curve.getData() + stepMode = curve.opts['stepMode'] if plot.yData is not None and y.shape == plot.yData.shape: # note that if shapes do not match, then the average resets. newData = plot.yData * (n-1) / float(n) + y * 1.0 / float(n) - plot.setData(plot.xData, newData) + plot.setData(plot.xData, newData, stepMode=stepMode) else: - plot.setData(x, y) + plot.setData(x, y, stepMode=stepMode) def autoBtnClicked(self): if self.autoBtn.mode == 'auto':