how can i write the number of line?
Show older comments
Hi!
I have a 2D plot and I want to appear on each point of the graph, the number of lines corresponding to the matrix of data.
Is there any way?
Thank you!
3 Comments
Matz Johansson Bergström
on 24 Jan 2015
Can you provide us with an example?
Giorgos Papakonstantinou
on 24 Jan 2015
Hi Thodoris. Can you explain a bit more your question? I don't understand which lines you want to show in the 2D plot?
Thar
on 25 Jan 2015
Accepted Answer
More Answers (1)
Image Analyst
on 25 Jan 2015
Try this:
m=[...
300 3.345
301 4.456
303 5.789]
for row = 1 : size(m, 1)
x = m(row, 1);
y = m(row, 2);
plot(x, y, 'b*', 'MarkerSize', 15);
hold on;
caption = sprintf('(%.3f, %.3f)', x, y);
text(x+0.8, y, caption, 'FontSize', 15);
end
grid on;
xlim([296, 315]);

Categories
Find more on Graphics Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!