Custom Data Cursor

This function allows a user to label each point in a data series with custom labels.

이 제출물을 팔로우합니다

customDataCursor allows a user to label each point in a data series with custom labels. When the data cursor mode is enabled (DATACURSORMODE ON), clicking on a data point will display the custom label, then the x and y values of the data point. If more than one data point of the data series is in the same location, the data cursor will display all of the labels first, then the x and y locations.

Usage: customDataCursor(H,DATALABELS) applies the custom labels found in cell array DATALABELS to the line with handle H. DATALABELS must be a cell array with the same length as 'XDATA' and 'YDATA' in the line; in other words, there must be a label for each data point in the line.

dcmH = customDataCursor(H,DATALABELS) returns the handle to the data cursor in dcmH.

Note: CUSTOMDATACURSOR uses the 'UserData' property of a line to store and retrieve the labels. If that property is used by another portion of a user's program, this function may be broken, or this function may break the user's program.

Example:
% generate some data and chart it
N = 20;
x = rand(N,1);
y = rand(N,1);
h = plot(x,y,'ko');
% make up some labels and apply them to the chart
labels = cell(N,1);
for ii = 1:N
labels{ii} = ii;
end
customDataCursor(h,labels)

인용 양식

Dave Van Tol (2026). Custom Data Cursor (https://kr.mathworks.com/matlabcentral/fileexchange/18773-custom-data-cursor), MATLAB Central File Exchange. 검색 날짜: .

카테고리

Help CenterMATLAB Answers에서 Data Exploration에 대해 자세히 알아보기

일반 정보

MATLAB 릴리스 호환 정보

  • 모든 릴리스와 호환

플랫폼 호환성

  • Windows
  • macOS
  • Linux
버전 퍼블리시됨 릴리스 정보 Action
1.0.0.0

Modified code to fix bug reported by Ahmed Andalusi. Although I could not recreate the error message reported, I think I understand the offending line of code and have changed it to use a cell array rather than a string array. Thanks, Ahmed.