Label scatter data points.

I have a matrix C as follows;
1 3 0.454 54
3 4 0.478 0.356
7 8 4.564 1546
And I plot, scatter(C(:,3),C(:,4))
I want to label every data point as first two columns of matrix. Like, label (0.454,54) as 1 3, (0.478,0.356) as 3 4 and so on.

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 12 月 4 日

0 投票

text( C(:,3),C(:,4), cellstr(str2num(C(:,1:2))) )

3 件のコメント

dipak sanap
dipak sanap 2015 年 12 月 4 日
Hey thanks for a reply, but this gives error Error using str2num (line 32) Requires string or character array input. May be I cant use matrix as an input for str2num.
Walter Roberson
Walter Roberson 2015 年 12 月 4 日
Sorry, I have been up all night ;-(
text( C(:,3),C(:,4), cellstr(num2str(C(:,1:2))) )
dipak sanap
dipak sanap 2015 年 12 月 4 日
Hey thanks, it worked. And get some sleep.

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

カテゴリ

タグ

質問済み:

2015 年 12 月 4 日

コメント済み:

2015 年 12 月 4 日

Community Treasure Hunt

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

Start Hunting!

Translated by