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?
            Asked
            
        
        
            Active
            
        
            Viewed 3.9k times
        
    16
            
            
        - 
                    possible duplicate of [Labeling points in order in a plot in MATLAB](http://stackoverflow.com/questions/4140312/labeling-points-in-order-in-a-plot-in-matlab), [How do I label two vectors in Matlab?](http://stackoverflow.com/questions/2243069/how-do-i-label-two-vectors-in-matlab) – Amro Aug 17 '11 at 22:59
 
1 Answers
30
            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')

        Amro
        
- 123,847
 - 25
 - 243
 - 454