How to plot matrix points with label

20 ビュー (過去 30 日間)
MIGUEL FILHO
MIGUEL FILHO 2017 年 6 月 30 日
コメント済み: MIGUEL FILHO 2017 年 6 月 30 日
This might be a dumb question, but I am iniciating in Matlab and i want to know how can I plot matrix points and give then names.
Z =
1 2
3 4
55 1
4 4
90 100
As example, this would have 5 points, being x1(1,2), x2(3,4), x3(55,1).. etc
Thanks in advance

採用された回答

Chad Greene
Chad Greene 2017 年 6 月 30 日
Plot the points with the plot function like this. Here I'm making them red x marks by specifying 'rx':
plot(Z(:,1),Z(:,2),'rx')
Or since those numbers span a big range and some are clustered near zero, perhaps you want a loglog axis scaling:
loglog(Z(:,1),Z(:,2),'rx')
Take your pick of plot or loglog, then label each point with the text function.
names = {'x1';'x2';'x3';'x4';'x5'};
text(Z(:,1),Z(:,2),names)
If you want to make the text labels red, italics, and centered on the points, do so like this:
text(Z(:,1),Z(:,2),names,'color','red','fontangle','italic','horizontalalignment','center','verticalalignment','middle')
  1 件のコメント
MIGUEL FILHO
MIGUEL FILHO 2017 年 6 月 30 日
THanks so much, worked perfectly

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Distribution Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by