File Exchange Pick of the Week

Our best user submissions

Draggable Data Tips 4

Posted by Jiro Doke,

Jiro‘s pick this week is DragDataTip by Allen.

Here’s a simple, but quite useful utility to use in conjunction with MATLAB’s data tips. It customizes the data tips so that you can drag the labels to any location for better visibility.

The entry requires you to also download and install draggable by Francois Bouffard. It is also worth noting that Allen’s entry was inspired by an earlier entry, Draggable data tips, by the famous Yair Altman. (Note that Yair’s entry does not run on R2014b or newer.)

Here’s an example of Allen’s entry in action.

hFig = figure;
hLin = plot(peaks);
grid on
title('Draggable Data Tips')
xlabel('Data Index Values')
ylabel('Acceleration (g''s)')
hFig.KeyPressFcn = {@DragDataTip,gca};

Then create some data tips using the built-in feature. Once you’re done (and turned off the datacursor mode), press Ctrl-M. This converts the standard data tips to Drag Data Tips. Then you can move the data tips to any location.

See this in action.

You can find other examples in the help of DragDataTip.

help DragDataTip


Give it a try and let us know what you think here or leave a comment for Allen.

Get the MATLAB code

Published with MATLAB® R2018b


Comments are closed.

4 CommentsOldest to Newest

Andre Zeug replied on : 1 of 4
Probably function(laity) changed. Please use DragDataTip(hFig) instead of hFig.KeyPressFcn = {@DragDataTip,gca}; shown in the example above. A
Yair Altman replied on : 2 of 4
Jiro - It's a shame that this POTW post fails to acknowledge my "Draggable Data Tips" submission from 2013 (, which was the first submission to address this need and which directly inspired Allen's submission. On the FEX page, Allen acknowledges my submission, and it would have been honorable for you to do the same. If your reasoning was that my submission relies on undocumented aspects, then I would say that: (1) this is irrelevant since you're highlighting Allen's utility and not mine, you'd just be acknowledging mine, and (2) guess what? Allen's submission also relies on undocumented aspects (this is not stated anywhere but is a fact if you review the code). The only difference in this between our submissions is that I clearly state the undocumented aspect of my utility with a prominent notice.
Hi Yair, Please accept my apologies. I don't have any excuses to make, and my reason for not acknowledging your submission was my ignorance. I completely missed the acknowledgement section of the entry, and I missed to identify the undocumented aspects of the entry.