Open
Description
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:
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:
Metadata
Metadata
Assignees
Labels
No labels