Skip to content
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

Allow adjustment of histogram bins #239

Open
K-Meech opened this issue Dec 14, 2023 · 1 comment · May be fixed by #242
Open

Allow adjustment of histogram bins #239

K-Meech opened this issue Dec 14, 2023 · 1 comment · May be fixed by #242
Labels
New feature New feature or request

Comments

@K-Meech
Copy link

K-Meech commented Dec 14, 2023

It would be great to allow:

  • Adjustment of histogram bin width / locations via the UI
  • Using integer bin limits for integer images (e.g. uint8, uint16)

For example, if you show the coins image in Napari (File > Open Sample > napari builtins > Coins) and view the histogram, it has an odd 'spiky' appearance where every other bin is higher or lower:
Screenshot 2023-12-14 121238

I think this is because the limits of the bins aren't set to integer values (even though this image is uint8 and therefore only contains positive integers). E.g. I think the bins are np.linspace(1, 252, 100) according to here, so for example bin 20 onwards is: 51.7, 54.2, 56.7, 59.3, 61.8, which means the bins accept pixel values of (52, 53, 54), (55, 56), (57, 58, 59), (60, 61)... This alternating of 2 and 3 pixel values in each bin gives this spiky appearance which is a bit misleading to the actual values. Would it be possible to set integer bin edges, or allow this to be set as an option? Thanks!

@dstansby
Copy link
Member

dstansby commented Jan 7, 2024

👍 to doing this, a pull request that implements both suggestions (integer bins for integer data, and a bit of GUI to customise the bins) would be welcome. I'd recommend going with the integer bins first as that will require much less design work and be easier to implement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants