File Exchange

image thumbnail

add_DataTips

version 1.5.0 (49.5 KB) by Massimo Ciacci
A simple tool to create multiple data tips on multiple line handles, with color matched to that of each curve.

12 Downloads

Updated 25 May 2020

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

% ADD_DATATIPS( x_values , [h_curve_Array], [fontSize, nx,ny])
% Creates multiple data tips on multiple line handles
% with color matched to that of each curve.
% Tips are created at location xi,fn(xi) where
% xi = x_values,
% fn(xi) = defined by (XData,YData) in h_curve_Array(n)
%
% INPUTS:
% ------
% h_curve_Array = a single Line handle or an array of them
% x_values = array of x value where data tips are requested
% fontSize = self explanatory
% nx,ny = nr of digits used for representation x,y(z)

% EXAMPLE:
% figure(); hold on;
% p_h(1) = plot(0:10,(0:10).^2,'b');
% p_h(2) = plot(0:10,(0:10),'r');
% add_DataTips( [3.3,5.5,7.7] , p_h, 7)
%
% EXAMPLE:
% figure(); hold on;
% plot(0:10,(0:10).^2,'b');
% plot(0:10,(0:10),'r');
% add_DataTips( [3.3,5.5,7.7])
%
% M.Ciacci, 2019/11/26, rev1.4

Cite As

Massimo Ciacci (2020). add_DataTips (https://www.mathworks.com/matlabcentral/fileexchange/72849-add_datatips), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (2)

Gopher Wood

Excellent work!
A small bug. No matched color of the background of the tip boxes in given demo. Actually, all background colors are gray. My matlab version is 2019a.

Updates

1.5.0

Hopefully fixed issue with the background color of the data tips.

1.4.0

Now one can pass empty handles ( h_curve_Array) and the function will fetch them from gca.

1.3.0

Fixed background color with simpler HSL space which preserves hue.

1.2.0

Solved this warning by adding a check on interp position of tip:
Warning: Error updating PointDataTip.
DataSpace or ColorSpace transform method failed"

1.1.0

updated for ML2016b: added drawnow to fix potential error
prevent error when data tip out of current xlims

1.0.1

removed unused old code

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