File Exchange

image thumbnail

Programmatically Datatip Generation with Matlab Implementation

version 1.1.0.0 (2.27 KB) by Hristo Zhivomirov
Programmatically generation of a custom made datatip on a given Matlab figure.

7 Downloads

Updated 28 Dec 2017

View License

The present code is a Matlab function that provides programmatically generation of a custom made datatip on a given Matlab figure (e.g. 2D and 3D lines, 3D surfaces, etc.). The function is very suitable for dynamic (animated) plots. The user can:
1) set the datatip position anywhere on the plot via data indexes;
2) set a custom X, Y and Z datatip labels;
3) hold the previously placed datatips.
Two examples are given in order to clarify the usage of the function. For convenience, the input and output arguments are given in the beginning of the function.

Warning: One must uncomment the code line 55 for Matlab R2014a and earlier.

Comments and Ratings (6)

kulbhushan

asmith9455

Hello, great function here. Just wanted to say that in order to prevent the text in all datatips from changing to match the newest str, I commented out line 55 (updateDataCursors(cursorMode)). This allowed me to put many different data tips with different text in each on the same plot. Not sure if this was the right way to do it, but it works quite well! Thank you for creating this function.

Hi Siddaharth! First of all, thank you for your interest in my submission! As I wrote in the file information form, please comment the function code line 53 for Matlab R2014b and later, this will solve the problem.

All best,
Hristo Zhivomirov

Hi there,
when I run the examples 1 and 2 I get an error in line 53.
Could you look into it?

Hi Philipp! My function use a matrix indexing and the indexes must be integers. If your main program pass the noninteger indexes to the function, you must round them beforehend.

Best regards,
Hristo Zhivomirov

Philipp

Hi,

thanks for this submission,
does a way exist for creating datatips at non-integer indices?
That option corresponds to the datacursormode object's property 'SnapToDataVertex', which may be switched off to allow for non-integer indices.

Kind regards,
Philipp

Updates

1.1.0.0

A new version of the code has been uploaded.

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired by: MAKEDATATIP