MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   在图中按顺序标记点 (https://www.labfans.com/bbs/showthread.php?t=24096)

poster 2019-12-10 20:48

在图中按顺序标记点
 
我有两个向量代表要绘制的点(x,y)的位置。

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



[B]回答:[/B]

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

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') [IMG]https://i.stack.imgur.com/NaKG9.png[/IMG]



[url=https://stackoverflow.com/questions/4140312]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 23:25

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.