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?
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.
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.
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')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With