connect lines on scatter plot showing arrows
14 views (last 30 days)
I am plotting 2 scatter plots on the same figure with corresponding points. I would like to connect each pair of points with an arrow towards the second. Here is my code so far
figure; scatter(xpre,ypre,'filled','SizeData',100,'MarkerEdgeColor',[0 0 0],'MarkerFaceColor',[.4940 .1840 .5560]);hold on;scatter(xpost,ypost,'filled','SizeData',100,'MarkerEdgeColor',[.9290 .6940 .1250],'MarkerFaceColor',[.9290 .6940 .1250]);hold on
for i = 1:22
plot([xpre(i,:) xpost(i,:)],[ypre(i,:) ypost(i,:)],'-->','Color',[0 0 0],'LineWidth',2);
However I get the attached figure. Grateful for any assistance. Thank you!