查看单个帖子
旧 2019-12-10, 20:48   #1
poster
高级会员
 
注册日期: 2019-11-21
帖子: 3,006
声望力: 66
poster 正向着好的方向发展
帖子 在图中按顺序标记点

我有两个向量代表要绘制的点(x,y)的位置。

我知道如何绘制它们,但我也想用在图中可见的标签来标记它们1、2、3、4...。标签表示它们在向量中的顺序。



回答:

这是执行此操作的一种方法:

p = rand(10,2); labels = cellstr( num2str([1:10]') ); %' # labels correspond to their order plot(p(:,1), p(:,2), 'rx') text(p(:,1), p(:,2), labels, 'VerticalAlignment','bottom', ... 'HorizontalAlignment','right')



更多&回答...
poster 当前离线   回复时引用此帖