overplot contours on image

3 Ansichten (letzte 30 Tage)
Venkatessh
Venkatessh am 19 Jun. 2013
How can I overplot contours on an image? The image and the contours have different limits. I tried plotting the image using the bottom x-axis and left y-axis and the contrary for the contours. But it doesn't work.
My code:
imagesc(1:100,1:100,C)
ax1 = gca;
ax2 = axes('Position',get(ax1,'Position'),...
'XAxisLocation','top','YAxisLocation','right',...
'Color','none',...
'XColor','k','YColor','k');
contour(ax2,Z)
This only displays the contours. I am unable to see the image.
Can someone provide any assistance?

Akzeptierte Antwort

Angus
Angus am 19 Jun. 2013
Regardless of limits, you need to use 'hold on' before executing the contour function or it will always overwrite the image that is in the axis.
If you have tried this then let me know and ill look at it again. That was just what first jumped out at me :)
  5 Kommentare
Venkatessh
Venkatessh am 19 Jun. 2013
Placed the hold on at a wrong place. Now it works!
Thank you.
Angus
Angus am 19 Jun. 2013
Great! Haha, I wasn't too sure where to go from there, glad that worked.
Cheers, Angus.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by