Text on point in a 2D plot

7 ビュー (過去 30 日間)
marco97f
marco97f 2023 年 5 月 17 日
コメント済み: Mathieu NOE 2023 年 5 月 17 日
Hi, I have a series of point plot as follows using a matrix Nx3 matrix
scatter(xp,yp,100,c,'filled')
with color that changes depending of values of a third column, which has the same lenght of xp and yp.
Is there a way to display even the numerical value of the third column near each points on the plot?

採用された回答

Mathieu NOE
Mathieu NOE 2023 年 5 月 17 日
編集済み: Mathieu NOE 2023 年 5 月 17 日
hello
you can use text for that job
xp = 1:0.5:2*pi+1;
yp = 0.1*xp+sin(xp);
c = rand(size(xp));
scatter(xp,yp,100,c,'filled') ;
xlim([0 8]);
for ci =1:numel(xp)
text(xp(ci),yp(ci)+0.1,num2str(c(ci),2))
end
  2 件のコメント
marco97f
marco97f 2023 年 5 月 17 日
Thank you, it works.
Mathieu NOE
Mathieu NOE 2023 年 5 月 17 日
my pleasure !

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by