MATLAB: Two colormaps in the same plot

color axescontour plotsuperimpose imagestwo colormapundocumented

Hi,
I am superimposing two images, here, I would like to use different colormap for first and second images. For e.g. jet for image 1 and hot for image 2..
I have tried this, however, at the end, both the images got the colromap defined for image 2. If somebody has gone through this kind of situtaion, please help me with this..

Best Answer

The ColorBar object has an undocumented Colormap property. You can set this property directly to control the colors displayed by the ColorBar. You can use the documented properties such as Limits so that the display corresponds to your original data values.
Just be aware that the ColorBar's behavior with the respect to the Colormap property might change in a future release.
And don't tell anyone that I told you about this. ;-)