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

norm doesn't have impact for single image channel rendering when clip=False #418

Open
Sonja-Stockhaus opened this issue Feb 4, 2025 · 0 comments
Assignees

Comments

@Sonja-Stockhaus
Copy link
Collaborator

from matplotlib.colors import Normalize
from matplotlib import rcParams
import spatialdata_plot
from spatialdata.datasets import blobs

blob=blobs()

cmap = matplotlib.colormaps[rcParams["image.cmap"]]
cmap.set_under("black")
cmap.set_over("grey")

norm = Normalize(vmin=0.3, vmax=0.7, clip=False)

blob.pl.render_images(element="blobs_image", channel=0, norm=norm, cmap=cmap).pl.show()

The result looks like the original image when you render channel 0 without any norm, except for the colorbar:

Image

This is because imshow() gets the already normalized data, but doesn't know that - so it autoranges to show everything on the colormap.
When passing the Normalize object directly to the norm argument of imshow, we get the desired behavior:

Image

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

No branches or pull requests

1 participant