Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Data label on each entry in xy scatter

Tags:

matlab

I have an x-y scatter plot in MATLAB and want to put a data label on each point. I can't seem to find this in the documentation. Is it possible?

like image 200
Brian Avatar asked Aug 17 '11 22:08

Brian


People also ask

How do I add labels to an XY scatter plot in Excel?

Do add the data labels to the scatter chart, select the chart, click on the plus icon on the right, and then check the data labels option. This will add the data labels that will show the Y-axis value for each data point in the scatter graph.

How do you label each point in a scatter plot sheet?

To add labels to the points in the scatterplot, click the three vertical dots next to Series and then click Add labels: What is this? Click the label box and type in A2:A7 as the data range.


1 Answers

Example:

p = rand(10,2);
scatter(p(:,1), p(:,2), 'filled')
axis([0 1 0 1])

labels = num2str((1:size(p,1))','%d');    %'
text(p(:,1), p(:,2), labels, 'horizontal','left', 'vertical','bottom')

enter image description here

like image 148
Amro Avatar answered Sep 20 '22 01:09

Amro