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

Lines changed: 3 additions & 2 deletions
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):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy