[datacursermode] Counter for data tips in a figure
Show older comments
Hello everybody
I would like to have some kind of counter in my figure, that displays the number of data tips in my figure in real time. If I add a data tip the counter has to raise and if I delete a data tip the counter should decline.
Thanks in advance
Answers (2)
Fritz
on 31 Oct 2014
Sean de Wolski
on 31 Oct 2014
In R2014b, you can look for found parts of the axes that are PointDataTips
fig = figure;
ax = gca;
plot(rand(1,10))
% add some data tips
ntip = 0;
h = findall(ax);
for ii = 1:numel(h)
ntip = ntip+isa(h(ii),'matlab.graphics.shape.internal.PointDataTip');
end
disp(ntip)
There's probably a similar thing you can search for in releases before 14b.
Categories
Find more on Environment and Settings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!