Skip to content

Comments

Prevent automatic scalar mapping when plotting RGB images#872

Open
atedstone wants to merge 3 commits intoGlacioHack:mainfrom
atedstone:rgb_contrast
Open

Prevent automatic scalar mapping when plotting RGB images#872
atedstone wants to merge 3 commits intoGlacioHack:mainfrom
atedstone:rgb_contrast

Conversation

@atedstone
Copy link
Member

@atedstone atedstone commented Feb 18, 2026

Relates to prep. work for #860 . I found a bug where we are passing a cmap value to plt.imshow() when using Raster.plot() to plot a multi-band image (e.g. RGB). This results in imshow() triggering some kind of scalar remapping of the supplied data. This is not a desired automatic behaviour as we are then not in control of this remapping. In my tests I found that it brings a danger of introducing a colour contrast in some extreme images (e.g. accumulation zone of the Greenland Ice Sheet).

By passing cmap=None we disable this behaviour.

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

Successfully merging this pull request may close these issues.

1 participant