Skip to content

Commit 11590b2

Browse files
committed
Calculate step using n_bins-1
n_bins corresponds to number of bin edges rather than bins
1 parent d56942b commit 11590b2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: src/napari_matplotlib/histogram.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def draw(self) -> None:
208208
# whole cube into memory.
209209
if data.dtype.kind in {"i", "u"}:
210210
# Make sure integer data types have integer sized bins
211-
step = abs(self.bins_stop - self.bins_start) // self.bins_num
211+
step = abs(self.bins_stop - self.bins_start) // (self.bins_num - 1)
212212
step = max(1, step)
213213
bins = np.arange(self.bins_start, self.bins_stop + step, step)
214214
else:

0 commit comments

Comments
 (0)