Whenever I plot this image I get issues with the whites turning yellow. I know it's due to the default color mapping viridis, which matplotlib uses. When I switch to cmap='gray', it ends up showing the right red color pane.
Can anyone explain why this is happening? What color map should be used generally for pictures like this? How is the picture able to show the right colors when I do the default imshow(img)? What changes when I isolate the a single color pane? And when isolating red green or blue color panes in images, what is the preferred cmap and why?
This is the output for the red color pane
The regular image plots correctly according to RGB color mode:
imshow
on the entire image,imshow
has the rgb data available and the default is to then just display the image. If you use just one channel (in your case red), what you are left with is grey scale data. When you useimshow
on such data, the default is to use a color map in order to make differences more easily distinguishable. And the default colormap just happens to beviridis
. – Thomas Kühn