How to superimpose contourf plot over a gray scale image

1 次查看(过去 30 天)
I'm encountering a problem to superimpose contourf plot over a gray scale image. i uesd "imagesc" to show the gray image and "hold on, contourf" to show the data plot. Also, i tried using two colormaps in a same figure. But that was not working. please give me some advice to overcome it.thank you!
  1 个评论
dpb
dpb 2013-7-7
For what definition of "not working"
I'm not image expert but you'll have make use of transparency to see anything "thru" the top layer...
Show what you did do so a real expert on images can point out specific difficulties. Using one of the sample installed images and providing a generating function (short, preferably) for the contour object would be pluses so can be reproduced easily. Sure, it's not precisely your specific problem but methods are methods...

请先登录,再进行评论。

回答(1 个)

David Sanchez
David Sanchez 2013-7-8
Solution given Teja Muppirala more than a year ago:
%Make some sample grayscale image
I = abs(sin((1:500)'/100)*sin((1:500)/100));
% Convert the grayscale image to RGB
Irgb = cat(3,I,I,I);
%Plot the image and some contours in color
image(Irgb)
hold all
contour(I);

类别

Help CenterFile Exchange 中查找有关 Contour Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by