File Exchange

image thumbnail

add_DataTips

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

5 Downloads

Updated 03 Dec 2020

View Version History

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)
% set nx=0 if you only want to display y value
% set ny=0 if you only want to display x value
%
% 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])
%
% EXAMPLE skipping X values (by setting nx = 0)
% figure(); hold on;
% plot(0:10,(0:10).^2,'b');
% plot(0:10,(0:10),'r');
% add_DataTips([3.3,5.5,7.7], [],[] ,0)
%
% EXAMPLE skipping Y values (by setting ny = 0)
% figure(); hold on;
% plot(0:10,(0:10).^2,'b');
% plot(0:10,(0:10),'r');
% add_DataTips([3.3,5.5,7.7], [],[] ,2,0)
%
% M.Ciacci, 2020/03/20, rev1.5
% M.Ciacci, 2020/07/10, rev1.6
% M.Ciacci, 2020/12/03, rev1.7

Cite As

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

Comments and Ratings (4)

Chang hsiung

Ihsan Erdin

Excellent.

Chang hsiung

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.

MATLAB Release Compatibility
Created with R2016b
Compatible with R2014b and later releases
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!