I often want to plot a difference image that ranges from some negative number to some positive one. The issue with that is that matlab's colormaps scale only from the min value to the max value but do not care about some middle value (this case zero). For example, I have produced the peaks image with a single pixel different:

where the original looks like this:

So zero values are blue at the top image and green at the bottom... (using jet colormap as an example)
I'd like to built a colormap that will automatically represent zero values as the same color no matter what will be the min\max values. How can I do that?



[-1,1]. - Marc Claesencaxisto control the color mapping by using a zero-centered range, that way0is always in the middle (assuming you are using scaled color mapping as opposed to direct mapping) - Amro