Reputation: 99
I've an axes with multiple plot . I would like to know if there is a way to detect which plot I've cliked using datacursor mode. I've already a callback that give the value I've cliked.
Upvotes: 3
Views: 284
Reputation: 7751
As documented in matlab, datacursormode
can output the handle of the target line (or any graphical object) your cursor is on. The property Target
in the following code is used to make the plot thicker.
dcm_obj = datacursormode(fig); %enable data cursor mode
cursor_info = getCursorInfo(dcm_obj); %get the properties
set(cursor_info.Target,'LineWidth',2) %the target handle is Target
Upvotes: 3