From 392d2a3475b4247c277d2c3b051d044e37870adc Mon Sep 17 00:00:00 2001 From: mrussell Date: Mon, 6 Jul 2015 16:21:06 +0100 Subject: [PATCH] Log scale and fft transform fix If the plotted data is fourier transformed and an x log scale is chosen, the first bin causes an error because np.log10(0) doesn't make any sense. --- pyqtgraph/graphicsItems/PlotDataItem.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyqtgraph/graphicsItems/PlotDataItem.py b/pyqtgraph/graphicsItems/PlotDataItem.py index ce959a98..37245bec 100644 --- a/pyqtgraph/graphicsItems/PlotDataItem.py +++ b/pyqtgraph/graphicsItems/PlotDataItem.py @@ -523,6 +523,10 @@ class PlotDataItem(GraphicsObject): #y = y[::ds] if self.opts['fftMode']: x,y = self._fourierTransform(x, y) + # Ignore the first bin for fft data if we have a logx scale + if self.opts['logMode'][0]: + x=x[1:] + y=y[1:] if self.opts['logMode'][0]: x = np.log10(x) if self.opts['logMode'][1]: