Enable data cursor mode
Data tips are small text boxes that display information about individual data
points. In releases prior to R2018b, use the datacursormode
function to
create and edit data tips. Control data tip appearance and behavior by using
datacursormode
to create a data cursor manager object.
Starting in R2018b, you can create and edit data tips using built-in interactions instead. Built-in interactions do not require you to enable a mode and respond faster than interaction modes. For more information about built-in interactions, see Control Chart Interactivity.
Most charts support data tips, including line, bar, histogram, and surface charts. Charts
that support data tips typically display the data tips icon in the axes toolbar.
datacursormode on
turns on data cursor mode for charts in the
current figure. With data cursor mode on, create a data tip by clicking a data point. To
create multiple data tips, hold the Shift key while clicking the data
points.
datacursormode off
turns off data cursor mode. This command
does not remove existing data tips. Some built-in interactions are enabled by default,
regardless of the mode. To disable built-in data tip interactions, use the disableDefaultInteractivity
function.
datacursormode
toggles data cursor mode between
'on'
and 'off'
. This syntax is the same as
datacursormode toggle
.
datacursormode(
sets
the data cursor mode for charts in the specified figure. Specify the additional argument
as fig
,___)'on'
, 'off'
, or 'toggle'
.
For example, use datacursormode(fig,'on')
.
getCursorInfo |
|
In general, data tips show the coordinates of the selected data point. However, for
some types of charts, data tips display specialized information. For example, histograms
created using the histogram
function display data tips that
itemize the observation counts and bin edges.
To programmatically create and customize data tips, use the datatip
and
dataTipTextRow
functions. For more information, see Create Custom Data Tips.