Is there any way to display a value instead of circles for points on a plot?

조회 수: 1 (최근 30일)
Is there any way to display a value instead of circles for points on a plot?

채택된 답변

Walter Roberson
Walter Roberson 2016년 11월 18일
a=1:10:100;
b=sin(a);
plot(a,b);
labels = arrayfun(@(A,B) sprintf('%g:%g', A, B), a, b, 'Uniform', 0);
text(a, b, labels)

추가 답변 (1개)

Brendan Hamm
Brendan Hamm 2016년 11월 17일
You can use the text function.
x = rand(5,1);
y = rand(5,1);
txt = num2str((1:5)');
text(x,y,txt)
  댓글 수: 1
joys roselin
joys roselin 2016년 11월 18일
편집: Walter Roberson 2016년 11월 18일
It doesn't work it out...can u tell me whether it suits for this code?
a=1:10:100;
b=sin(a);
plot(a,b);
txt = num2str((a:b)');
text(a,b,txt);

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by