DataTipInteraction - Data tip interaction - MATLAB (original) (raw)

Main Content

Description

A data tip interaction allows you to display data tips within a chart without having to select any buttons in the axes toolbar. To enable data tips, set theInteractions property of the axes to adataTipInteraction object. When this interaction is enabled, the data tips appear when you hover, click, or tap within the chart.

To enable multiple interactions, set the Interactions property to an array of objects.

Creation

Syntax

Description

d = dataTipInteraction creates a data tip interaction object. With this interaction enabled, clicking or tapping displays a data tip at the nearest data point.

example

d = dataTipInteraction('SnapToDataVertex',snap) specifies whether data tips snap to the nearest data point. When snap is'off', clicking or tapping displays a data tip at the exact cursor location instead.

example

Properties

expand all

SnapToDataVertex — Display at closest data point

'on' (default) | 'off'

Display at closest data point, specified as one of these values:

Examples

collapse all

Axes with Data Tip and Pan Interactions

Create a surface plot. Get the current axes and replace the default interactions with the data tip and pan interactions. Then hover over the surface to display data tips. Click and drag or tap and drag to pan.

surf(peaks) ax = gca; ax.Interactions = [dataTipInteraction panInteraction];

Tips

Version History

Introduced in R2019a