% Now click on any point to produce the data tip (image below)
Method 2: return value to command window (or anywhere else you'd like)
This uses ginput() which allows the user to click on any space within the axes. It then computes the nearest point and returns its (x,y) coordinate and color value.
% User must select 1 point
[x,y] = ginput(1);
% Get (x,y) coordinates for all points
% *** This assumes the entire point was made with the one
% call to scatter() instead of several calls to scatter().
Best Answer