datatip

Adds a data tip, a small label showing a data point, to a chart.

Category: Graphics > Formatting and Annotation

Syntax

dt = datatip(chart, x, y)

Adds a data tip at the point (x, y) of a chart.

dt = datatip(chart, 'DataIndex', k)

Adds a data tip at the k-th data point.

Description

Data tips mark points of interest with a label that shows their coordinates. The tip is attached to a chart object, so it moves with the data.

Input arguments

chart
Handle of a line, scatter or similar chart object.
x, y
Coordinates of the point to label.

Output arguments

dt
Handle of the data tip.

Example

Labeling one point

p = plot(1:5);
dt = datatip(p, 3, 3);
disp(dt.X)
Output
     3

See also

plot text annotation scatter