필터 지우기
필터 지우기

connect lines on scatter plot showing arrows

조회 수: 5 (최근 30일)
bsriv
bsriv 2022년 4월 21일
댓글: bsriv 2022년 4월 21일
Hi,
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);
end
However I get the attached figure. Grateful for any assistance. Thank you!

채택된 답변

Bruno Luong
Bruno Luong 2022년 4월 21일
편집: Bruno Luong 2022년 4월 21일
Try this
quiver(xpre, ypre, xpost-xpre, ypost-ypre, 'off')
  댓글 수: 7
Bruno Luong
Bruno Luong 2022년 4월 21일
편집: Bruno Luong 2022년 4월 21일
This is beyond the question you ask, but I'll be nice to do somethibg you could figure out on your own that there is somethig call 'MaxHeadSize'
bsriv
bsriv 2022년 4월 21일
thanks!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by