From 2dc31b53dae47cef7eb3d84d1406a7b727cf1e9e Mon Sep 17 00:00:00 2001 From: Justin Engel Date: Thu, 13 Jul 2017 08:25:45 -0400 Subject: [PATCH] Fixed dataBounds error when all values were inf. If all values are inf. d = d[mask] will create an empty array. You cannot call min or max on an empty array. --- pyqtgraph/graphicsItems/PlotCurveItem.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pyqtgraph/graphicsItems/PlotCurveItem.py b/pyqtgraph/graphicsItems/PlotCurveItem.py index d66a8a99..4b876eb5 100644 --- a/pyqtgraph/graphicsItems/PlotCurveItem.py +++ b/pyqtgraph/graphicsItems/PlotCurveItem.py @@ -132,7 +132,11 @@ class PlotCurveItem(GraphicsObject): if any(np.isinf(b)): mask = np.isfinite(d) d = d[mask] - b = (d.min(), d.max()) + try: + b = (d.min(), d.max()) + except ValueError: + # d has no size, because all of d is inf. + b = (-1, 1) # Some default bounds elif frac <= 0.0: raise Exception("Value for parameter 'frac' must be > 0. (got %s)" % str(frac))