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 中查找有关 Annotations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by