how to name points in a plot?
62 ビュー (過去 30 日間)
古いコメントを表示
Hello,
i am interested in naming points of my plot wiht numbers. So i tried it the following way where i is the number that should describe my node.
for i=1:length(xk)
plot(xk(i),yk(i),sprintf( '#%i'))
i=i+1;
hold on
end
but it didnt work and this error occured:
--->??? Error using ==> plot
--->Error in color/linetype argument
--->Error in ==> Plotten at 51
---> plot(xk(i),yk(i),sprintf( '#%i'))
can anyone help me with that please?
with best regards, John
0 件のコメント
採用された回答
Stephan M. H.
2013 年 5 月 10 日
Hi John,
where you used sprint, the plot function expects as input LineSpec or 'PropertyName' followed by Propertyvalue.
I guess a direct way would be using the text function
...
plot(xk(i),yk(i))
text(xk(i),yk(i),num2str(i))
best,
Stephan
3 件のコメント
その他の回答 (1 件)
Azzi Abdelmalek
2013 年 5 月 10 日
編集済み: Azzi Abdelmalek
2013 年 5 月 10 日
for i=1:length(xk)
text(xk(i),yk(i),num2str(i))
hold on
end
1 件のコメント
Sushree Patra
2018 年 12 月 8 日
Without for loop how to provide the numbering to each point.
Means if
x1= 167*rand (50,1);
y1=302* rand (50,1);
plot(x1,y1,'b*');
参考
カテゴリ
Help Center および File Exchange で Line Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!