scverse / scverse/napari-spatialdata
Allow colormap scaling to reflect raw counts instead of hard-coded [0, 1] range
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 90
- Forks
- 25
- Avg merge
- 22m
- Merged PRs (30d)
- 1
Description
Hi there,
Currently, when visualizing gene expression or numerical observations in napari-spatialdata, the colormap and colorbar appear to be hard-coded to a range of $[0, 1]$. This is specifically seen in src/napari_spatialdata/_widgets.py (around line 488), where the data is normalized before being passed to the visualization layer.While normalization is useful for consistent styling, it makes it impossible for users to see the actual raw counts of a gene on the colorbar or via the contrast limits slider. For example, if a gene's expression ranges from 0 to 50, the colorbar still displays 0 to 1, and the user has no visual confirmation of the true expression magnitude.
I would like an option (or a change in default behavior) where:
- The colormap scale and contrast limits are automatically set to (min, max) of the raw counts for the selected gene/variable.
- The colorbar widget reflects these true values instead of the normalized $[0, 1]$ range.
- Users can manually adjust these limits in the napari layer controls to values outside the $[0, 1]$ range if needed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/napari_spatialdata/_widgets.py around line 488 and trace where the selected gene or variable is normalized before reaching the visualization layer. Check how contrast limits and the colorbar are configured, then verify that raw-value limits and manual values outside [0, 1] are reflected in the napari controls.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 67/100