Setting ButtonDownFcn disables default datatip functionality on hover

5 次查看(过去 30 天)
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 个评论
Jonatha Reis
Jonatha Reis 2022-6-17
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 2022-6-17
No, I manually swap between the two modes by selecting/deselecting the Datatips feature in the figure itself.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by