How to add an image to the current axes without replacing existing plots

조회 수: 3 (최근 30일)
Nirodha Sampath
Nirodha Sampath 2024년 2월 19일
댓글: Matt J 2024년 2월 23일
I have created a matrix, called "Final" and I want to plot its contour pattern on an image, in a polygon shape.
I tried "imagesc(Final,"XData",[min_x_2 max_x_2],"YData",[min_y_2 max_y_2],"AlphaData",0.5)" and was able to plot a rectangle contour map successfully. But I want to plot it on a RoI such as [1558,1798; 1790,1806; 1782,2006; 1562,2018].
(Note that the "Final" matrix's contour map might exceed the area of the polygon)
Thank you.

답변 (2개)

Matt J
Matt J 2024년 2월 19일
편집: Matt J 2024년 2월 19일
You can use hold
fcontour(@(x,y) (x-50).^2+(y-50).^2,[20,80],'m'); hold on
imshow(imread('cameraman.tif')); hold off
h=gca; h.Children=flip(h.Children);
  댓글 수: 2
Nirodha Sampath
Nirodha Sampath 2024년 2월 22일
Thank you very much Matt. That was really helpfull
Matt J
Matt J 2024년 2월 23일
I'm glad, but please Accept-click whichever answer resolved the question.

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2024년 2월 19일
See my attached examples to inset images and plots into other images and plots.

카테고리

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