Setting ButtonDownFcn disables default datatip functionality on hover

4 views (last 30 days)
Hello,
Matlab nicely has the builtin feature of viewing the data tips when the mosue hovers on a point in a plot.
However, when I try to set the ButtonDownFcn of the plot, this default data tip functionality is disabled.
Is there a way to have both: View data points on hover and fire a function when the plot is clicked?
Example:
figure()
a=plot(1:10,1:10)
%Figure now shows data tips perfectly
set(a,'HitTest', 'on', 'ButtonDownFcn',@(varargin)disp('Anything'))
%Running the last line disables the datatips on hovering to enable firing the disp function when plot is clicked
Many thanks!
  5 Comments
Jonatha Reis
Jonatha Reis on 17 Jun 2022
Did you manage to solve this issue? I am having the same problem and I just can't find the solution...
Ahmad Khaled
Ahmad Khaled on 17 Jun 2022
No, I manually swap between the two modes by selecting/deselecting the Datatips feature in the figure itself.

Sign in to comment.

Answers (0)

Categories

Find more on Line Plots in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!