Skip to content

Commit 559e1c1

Browse files
authored
Merge pull request #250 from p-j-smith/fix/histogram-float-bins
Ensure `HistogramWidget` always uses 100 bins by default
2 parents d7cca90 + 101b4e5 commit 559e1c1

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

src/napari_matplotlib/histogram.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ def _get_bins(data: npt.NDArray[Any]) -> npt.NDArray[Any]:
2626
step = np.ceil(np.ptp(data) / 100)
2727
return np.arange(np.min(data), np.max(data) + step, step)
2828
else:
29-
# For other data types, just have 128 evenly spaced bins
30-
return np.linspace(np.min(data), np.max(data), 100)
29+
# For other data types, just have 100 evenly spaced bins
30+
# (and 101 bin edges)
31+
return np.linspace(np.min(data), np.max(data), 101)
3132

3233

3334
class HistogramWidget(SingleAxesWidget):
Loading
Loading

0 commit comments

Comments
 (0)