zero-step in np.arange (#1468)

This commit is contained in:
miranis 2020-12-18 07:48:55 +01:00 committed by GitHub
parent 3af23725ca
commit c5c41b9090
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)