MATLAB Answers

Add numbers in a plot

372 views (last 30 days)
evangeline on 2 Mar 2018
Answered: KL on 2 Mar 2018
I have 10 points with x and y coordinates, and I am plotting circles that center in these coordinates. I need to add the numbers 1 to 20 on each circle. How can I do this? So each circle has a number on it in my figure. x=[3,5,8,6,1,2,4,5,7,9] y=[5,4,3,1,7,8,6,5,9,0] so I will have 10 circles.

  1 Comment

Jan on 2 Mar 2018
What does "circles that center in these coordinates" mean?
What do you expect as result of "adding 20 to a circle"? A circle is a geometric object, but 20 is a number.
How can a circle have a number on it? Do you want to insert text labels to the lines, e.g. as in contour plots (link)?
Please edit the question and try to be more clear.

Sign in to comment.

Answers (1)

KL on 2 Mar 2018
Assuming you know how to plot circles, you could use text command right after you plot the circle,
text(x,y,['(',num2str(x),',',num2str(y),')']) %for ex: x = 3, y = 5 (scalars)


Sign in to comment.

Sign in to answer this question.