Showing data values on markers in figure

조회 수: 54 (최근 30일)
geometry geometry
geometry geometry 2017년 11월 24일
편집: Juliette Koch 2021년 6월 18일
When I run: x=0.4:3.6;
x1=[.4 1 1.4 2 2.4 3 3.6];
y1=[17.25 33.6 36.72 37.2 36.8 36.75 32.7];
plot(x1,y1,'Marker','square','MarkerIndices',1:7);
xlabel('RL');
ylabel('P');
this figure opens:
How can I change the code so that the values on markers appear?

답변 (1개)

KL
KL 2017년 11월 24일
use text
something like
for t = 1:numel(x1)
text(x1(t)+0.1,y1(t)+0.1,['(',num2str(x1),',',num2str(y1),')'])
end
  댓글 수: 1
Juliette Koch
Juliette Koch 2021년 6월 18일
편집: Juliette Koch 2021년 6월 18일
I changed it into:
for t = 1:numel(x1)
text(x1(t)+0.1,y1(t)+0.1,['(',num2str(x1(t)),',',num2str(y1(t)),')'])
end
And it's perfect :)

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by