Skip to content

Instantly share code, notes, and snippets.

@erikhuizinga
Last active January 19, 2018 11:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erikhuizinga/589f0c5b216f4abd9dceb466ee9c0033 to your computer and use it in GitHub Desktop.
Save erikhuizinga/589f0c5b216f4abd9dceb466ee9c0033 to your computer and use it in GitHub Desktop.
Demo of how to add data cursor labels to any point in a graph
% Demo of how to add data cursor labels to any point in a graph
clear
close all
x = 1 : 10;
y = randn(size(x));
f = figure;
dcm = datacursormode(f);
l = plot(x, y);
for i = 1 : numel(x)
t = dcm.createDatatip(l);
t.Cursor.DataIndex = i;
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment