From c5c41b90909becd5641ca3a4c6e5abd4abd882a3 Mon Sep 17 00:00:00 2001 From: miranis <33010847+miranis@users.noreply.github.com> Date: Fri, 18 Dec 2020 07:48:55 +0100 Subject: [PATCH] zero-step in np.arange (#1468) --- pyqtgraph/graphicsItems/ImageItem.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyqtgraph/graphicsItems/ImageItem.py b/pyqtgraph/graphicsItems/ImageItem.py index 50cef315..479f4917 100644 --- a/pyqtgraph/graphicsItems/ImageItem.py +++ b/pyqtgraph/graphicsItems/ImageItem.py @@ -491,7 +491,9 @@ class ImageItem(GraphicsObject): if stepData.dtype.kind in "ui": # For integer data, we select the bins carefully to avoid aliasing step = np.ceil((mx-mn) / 500.) - bins = np.arange(mn, mx+1.01*step, step, dtype=np.int) + bins = [] + if step > 0.0: + bins = np.arange(mn, mx+1.01*step, step, dtype=np.int) else: # for float data, let numpy select the bins. bins = np.linspace(mn, mx, 500)