Skip to content

Ensure HistogramWidget always uses 100 bins by default #250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/napari_matplotlib/histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ def _get_bins(data: npt.NDArray[Any]) -> npt.NDArray[Any]:
step = np.ceil(np.ptp(data) / 100)
return np.arange(np.min(data), np.max(data) + step, step)
else:
# For other data types, just have 128 evenly spaced bins
return np.linspace(np.min(data), np.max(data), 100)
# For other data types, just have 100 evenly spaced bins
# (and 101 bin edges)
return np.linspace(np.min(data), np.max(data), 101)


class HistogramWidget(SingleAxesWidget):
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.