File Exchange

image thumbnail

Draggable data tips

version (4.78 KB) by Yair Altman
Enable dragging Matlab plot data-tips

1 Download

Updated 14 Mar 2019

View License

Matlab plots can display data-tips but these cannot be interactively moved except to the 4 corners of the data point.

This utility enables the user to interactively drag any newly-created data-tip, anywhere in the Matlab figure. A dashed line connects the dragged data-tip with the original data point.

The new draggable functionality only affects new data-tips, so it can be turned on/off to enable standard and new data-tips to co-exist in the same plot (see screenshot).

Syntax: draggableDataTips(newState)

draggableDataTips('on') or draggableDataTips(true) turns the new functionality ON for new data-tips.
draggableDataTips('off') or draggableDataTips(false) turns the new functionality OFF for new data tips.

Relies on undocumented functionality.
This utility fails in HG2 (R2014b+) - please don't bug me about it, unless you found a solution...
On HG2 (R2014b+), use Allen's submission:

Technical description:

Cite As

Yair Altman (2019). Draggable data tips (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (4)


Just wanted to pass along a solution for allowing draggable data tips on newer versions of MATLAB (see attached link).

Yair Altman

Aditya - a new version was just uploaded that fixes this minor problem.


I like this a lot. Thanks.

I found what could be a bug:
- create a datatip
- drag it so that the dashed line appears
- click on the dashed line and an error appears and the datatip goes away.

This is in 2013b 64 bit.

Here is the error:
err =

Error using set
Invalid handle

No public field DataIndex exists for class handle.

Error in graphics.datacursor/default_updateDataCursor
(line 38)
hDataCursor.DataIndex = ind;

Error in graphics.datacursor/updateDataCursor (line 31)

Error in graphics.datatip/update (line 22)

Error in datacursormode>localWindowButtonDownFcnDatatip
(line 781)

Error in datacursormode>localWindowButtonDownFcn (line

Error in hgfeval (line 63)

Error in uitools.uimode/modeWindowButtonDownFcn (line

Error in
(line 160)

Error while evaluating figure WindowButtonDownFcn


No code change; only clarified in the Description section that this utility fails on R2014b or newer. Users of recent Matlab releases should use Allen's submission instead (see comment on 3 Jan 2019).

Fixed the bug reported by Aditya on Nov 3, 2013

MATLAB Release Compatibility
Created with R2010b
Compatible with any release to R2014a
Platform Compatibility
Windows macOS Linux

Inspired: DragDataTip