How can I combine two gray colormap images in different colors?

8 views (last 30 days)
Hello all,
I have two gray colormap images that each represent a data density plot (darker regions = higher density).
I would like to be able to color them in different colors (preferably red and green) and then to combine the two images so that I can see where the two density plots overlap (in an intermediate color between red and green).
I've tried imfuse, and it's about what I'm looking for, except that the overlap between the two images isn't clear (it's just darker and not so much a different color).
Thanks in advance,
W

Answers (2)

Chad Greene
Chad Greene on 28 Jul 2014
You could make two color maps with rgbmap like this:
redmap = rgbmap('white','red');
greenmap = rgbmap('white','green');
Plot your red data set by pcolor or surf or whichever means you're using. Depending on how you plot the color data, you may need to use freezeColors before plotting the green data set. When you plot your two data sets, you can adjust transparency of the two data sets by setting the alpha value.
  1 Comment
William
William on 28 Jul 2014
The plots made using rgbmap look really good and are just what I'm looking for.
However, I can't figure out how to view both plots at the same time. The function I'm using is smoothhist2D , and the initial plot seems to disappear whenever I try to plot the second.

Sign in to comment.


Image Analyst
Image Analyst on 28 Jul 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!