plt.imshow(image_11[:,:,1], cmap="twilight", vmin=-1);# One single channel.
This works, but now this would be interpreted as a 1960 196x3 RGBA images.
What I had in ming was more like 30 196x196 RGBA images (3 channels for each of the 10 images).
Keep this in mind when using cmap.
image_batch = image_01.transpose(2,0,1)[None].repeat(10, axis=0)print(lo(image_batch))vals = (image_batch +1)/2lut_idxs = (vals * cmap.N).astype(np.int64)mapped = lut.take(lut_idxs, axis=0, mode="clip")print(lo(mapped))lo(mapped[:2]).rgb # First 2 of the images, each as 3 channels.
*Matplotlib colormap extended to have colors for +/-inf
Parameters extept cmap are matplotlib color strings.*
Type
Default
Details
cmap
Colormap
Base matplotlib colormap
below
Optional
None
Values below 0
above
Optional
None
Values above 1
nan
Optional
None
NaNs
ninf
Optional
None
-inf
pinf
Optional
None
+inf
tcmap = InfCmap(get_cmap("twilight"), below="blue", above="red", nan="yellow")rgb(tcmap(bad_image[:,:,0])) # Note: Mapped only first channel
tcmap = InfCmap(get_cmap("twilight"), below="blue", above="red", nan="yellow", ninf="cyan", pinf="fuchsia")rgb(tcmap(bad_image)[:,:,0]) # Note: Mapped all channels, show only the mapping for the first.