MATLAB Answers

How to label scatter plot with different name?(not number)

3 views (last 30 days)
Weixu Pan
Weixu Pan on 23 Feb 2018
Answered: Chandani Madnani on 26 Feb 2018
I have
x=randi([50 100],1,20);
y=randi([0 60],1,20);
figure
scatter(x,y);
hold on
plot(x(1:20),y(1:20),'w.');
hold on;
for k=1:20
text(x(k),y(k),{k});
end
Picture I want generate was attached
Thanks!

  0 Comments

Sign in to comment.

Answers (1)

Chandani Madnani
Chandani Madnani on 26 Feb 2018
Please see the following link:
https://www.mathworks.com/matlabcentral/answers/315124-how-do-i-display-custom-text-for-the-data-cursor

  0 Comments

Sign in to comment.

Sign in to answer this question.