Different color for saturated pixels in colormap
Show older comments
I have a contourplot using the jet colormap. When I set the max and min data points, using the 'CLim' property, the data points above and below the limiting values are mapped on to the max and min color values respectively (right plot).
My question is, would it be possible to set the saturated pixels, the dark red and dark blue ones on the right plot, to a different color? For example saturation beyond the max value to white and below the min value to black.
Thanks!

Accepted Answer
More Answers (1)
Walter Roberson
on 19 Aug 2016
0 votes
No, not directly.
You have two possibilities that I can think of at the moment:
1) create a new colormap with two additional colors, one on each end. It gets tricky to adjust the clim or values properly so that only the saturated (or underflow) pixels get those colors and not values that are nearly saturated or nearly underflowing.
2) Add an additional image() object positioned exactly over the contour map. At each non saturated point, set the AlphaData of the image object to 0, so that the contour map shows through. At each saturated point, set the AlphaData of the image object to 1, so that contour map does not show through. At the saturated points, set the CData property of the image() object to the RGB value you want (white) and at the underflow points, set the CData property of the image() object to the RGB value you want (black). CLim does not apply to RGB color so you do not need to worry about adjusting CLim or adjusting any values in the contour map.
Categories
Find more on Blue in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!