Skip to content

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

Open
@Sonja-Stockhaus

Description

@Sonja-Stockhaus
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

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions