MATLAB: Overlaying data on image

image analysisimage processingImage Processing ToolboxMATLABoverlay

I have a set of points that have been extracted from users clicking on an image, which I now need to show overlapping the original
figure1 = xlsread("AllAMDataCollated.xlsx","Sheet2");
x = figure1(:,1);
y = figure1(:,2);
hold on
for k=0
ind = ((k*40)+1):40*(k+1); % indices of data to plot. When k=0 ind equals 1 to 40. When k=1 ind equals 41 to 80
plot(x(ind),y(ind),'.')
title(["AM Data Points"])
xlabel("Xpixels")
ylabel("Ypixels")
grid
saveas(gcf,'inputs.png')
P1 = imread('inputs.png');
I = imread('AM\cropped\09_58_00.jpg');
figure
imshowpair(P1,I,'blend','Scaling','joint')
end
This is the figure I'm intrested with, the points in the plot were determined by clicking on the faint ellipse in the image I'm trying to overlay however the scale is all off. any help would be great!

Best Answer

Call plot() AFTER you display the image, not before.