필터 지우기
필터 지우기

Place coordinates in the plot legend

조회 수: 3 (최근 30일)
Miguel Albuquerque
Miguel Albuquerque 2022년 7월 21일
댓글: Star Strider 2022년 7월 21일
Hey guys, is there a way of putting those red letters in the plot, at the front of "target" in the legend?
Its just replacing x and y in text but I dont know what coordinates to put, this is the code;
plot(waypoints,azimuth2);
hold on
plot(waypoints,RMC);
plot(x,y,'^r');
textString2 = sprintf('(%2.f, %2.f)', x, y);
text(x, y,textString2,"Color",'r','FontSize',10);
title('Range over aeroplane movement');
xlabel('Waypoints (m)');
ylabel('Range (m)');
legend('Azimuth Compression','Range Migration Correction','Target');

채택된 답변

Star Strider
Star Strider 2022년 7월 21일
편집: Star Strider 2022년 7월 21일
Perhaps —
xv = 0:10:400;
ym = rand(2,size(xv,2))*3500;
x = 230;
y = 95;
figure
plot(xv, ym)
hold on
plot(x, y, '^r')
hold off
legend('Azimuth Compression','Range Migration Correction',sprintf('(%2.0f,%2.0f) Target',x,y))
EDIT — (21 Jul 2022 at 14:48)
Minor format changes to the plot.
.
  댓글 수: 2
Miguel Albuquerque
Miguel Albuquerque 2022년 7월 21일
Thanks
Star Strider
Star Strider 2022년 7월 21일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by