How can I write titles on scatter plot?

3 次查看(过去 30 天)
Giorgi
Giorgi 2015-9-17
评论: Giorgi 2015-9-17
Hello MATLAB Gurus! I have a Gui and axes1 to make scatter plot on it. Well I did it but I want to assign names to points on the graph. Any idea would be a great job for me. Thanks in advance.
a=[1,2,3,4];
b=[5,6,7,8];
names={'a','b','c', 'd'};
scatter(handles.axes2, a, b, 'filled')
  2 个评论
@Johannes
@Johannes 2015-9-17
Hi, you can use the Text function to add names to the data points.
Bye, john
Giorgi
Giorgi 2015-9-17
编辑:Giorgi 2015-9-17
Well i used text but it did not work in GUI axes :( Any other ideas?

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2015-9-17
See text() or annotation()
If you were to plot only one point at a time, you could use legend()
  3 个评论
Giorgi
Giorgi 2015-9-17
Well I did exactly how you wrote but it did not work in axes again but when I wrote it in command window it works. Any other idea?

请先登录,再进行评论。

类别

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