Data tips for multiple curves by mouse or arrow keys

버전 2.0.1 (1.21 MB) 작성자: Peter Seibold
The function 'DataTip.m‘ displays fully customizable data tips at the mouse pointer location. It works in regular figures or GUIs.
다운로드 수: 96
업데이트 날짜: 2021/1/23

라이선스 보기

FEATURES:
• Fully customizable data tips.
• No arguments to pass over. Retrieves all values out of the plot.
• Reaction on mouse click, mouse move or mouse move with button down.
• Works also with arrow keys.
• Activate right mouse button to show interpolated values.
• Displays the data point closest to the mouse pointer.
• Sticks on a curve by a certain distance to the mouse pointer.*)
• Replicates the color of the curve as box color of data tip.
• Works also in GUIs.

RESTRICTIONS:
• 2D plot
• One x-axis, not reversed, linear or log.
• One or two y-axes, not reversed, linear or log.
• Axes limits not set to -inf or inf, in log scale limits set to > 0
• At least one data point inside the plot
• For interpolated values at least 2 data points inside the plot.
No interpolation for vertical lines.

METHOD:
• Get the mouse pointer location
• Retrieve all data out of the plot
• Translation of all data points to centimeters
• Translation of mouse pointer location to cm
• Set origin at mouse pointer location
• Find foots of perpendiculars from mouse position to all data lines
• Determine closest point (line with shortest distance foot to mouse)
• Display data tip

MANUAL:
Copy the principal of the examples for regular figure or GUI.
Note: Data tip title is stored in the plot UserData.
SHORT EXAMPLE:
hFig = figure;
plot(1:.1:2,2:.1:3,'UserData','My data tip title');
%Track by mouse click:
set(hFig,'windowbuttondownfcn',@DataTip);
%Track by mouse move:
% set(hFig,'windowbuttonmotionfcn',@DataTip);

인용 양식

Peter Seibold (2020). Data tips for multiple curves by mouse click or mouse move , MATLAB Central File Exchange. Retrieved December, 2020.

MATLAB 릴리스 호환 정보
개발 환경: R2016a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
2.0.1

Added some restrictions in respect to axes limits

2.0.0

Added data tip by arrow keys.
Added interpolation of values.

1.1.1

upload of image failed, repeated again

1.1.0

Customizable data tips
Demo for data tip at mouse move with button down.

1.0.1

Removed error when negative data are present with log scale

1.0.0