%% Create Data Tip Using Index
% Plot data on a bar chart and return the Bar object. Then, create a data tip on the seventh bar by specifying the DataIndex name-value pair argument.

x = 1900:10:2000;
y = [75 91 105 123.5 131 120 107 96 82 73 70];
b = bar(x,y);

dt = datatip(b,'DataIndex',7);

% Copyright 2019 The MathWorks, Inc.