%% Create Data Tip Using Approximate Coordinates
% Plot data on a scatter chart and return the Scatter object. Create a data tip at the data point near (3,0) by specifying x = 3 and y = 0 as approximate coordinates. When you create a data tip using approximate coordinates, the data tip appears at the closest data point.

x = linspace(0,2*pi,20);
y = sin(x);
sc = scatter(x,y);
grid on;

dt = datatip(sc,3,0);

% Copyright 2019 The MathWorks, Inc.