How to display the coordinate of the point in the figure

66 ビュー (過去 30 日間)
suvadip paul
suvadip paul 2013 年 10 月 3 日
for i=15:55 for j=2:9 plot (i,j) end end
for the above program, I want to display the coordinate of the point near the point in the figure. e.g. for the first point I want to display (15, 2) beside the point. How to do this?

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 10 月 3 日
ii=1:5
jj=1:5
[x,y]=meshgrid(ii,jj)
figure
scatter(x(:),y(:),'.')
for k=1:numel(x)
text(x(k),y(k),['(' num2str(x(k)) ',' num2str(y(k)) ')'])
end
  2 件のコメント
suvadip paul
suvadip paul 2013 年 10 月 4 日
Thanks
mohan kanth
mohan kanth 2016 年 11 月 20 日
thanks..:)

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

その他の回答 (2 件)

Image Analyst
Image Analyst 2013 年 10 月 3 日
Try this:
for i=15:55
for j=2:9
plot (i,j, 'b.', 'MarkerSize', 20)
hold on;
textString = sprintf('(%d, %d)', i, j);
text(i-0.3, j+0.1, textString, 'FontSize', 7);
end
end
grid on;
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);

Afshin Aghayan
Afshin Aghayan 2019 年 10 月 8 日
you can use this code for displaying any data in the form of [x, y, f(x,y)] or data with coordinate

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by