Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1412149

Browse files
committed
ensure histogram bin step size is always a positive integer
1 parent 166d776 commit 1412149

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/napari_matplotlib/histogram.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def draw(self) -> None:
7272
# whole cube into memory.
7373
if data.dtype.kind in {"i", "u"}:
7474
# Make sure integer data types have integer sized bins
75-
step = 1 + (np.max(data) - np.min(data)) // 100
75+
step = 1 + abs(np.max(data) - np.min(data)) // 100
7676
bins = np.arange(np.min(data), np.max(data) + step, step)
7777
else:
7878
bins = np.linspace(np.min(data), np.max(data), 100)

0 commit comments

Comments
 (0)