Interactively Explore Plotted Data

You can interactively explore and edit plotted data to improve the visual display of the data or reveal additional information about the data. The interactions available depend on the contents of the axes, but typically include zooming, panning, rotating, data tips, data brushing, and restoring the original view.

Some types of interactions are available through the axes toolbar. The toolbar appears at the top-right corner of the axes when you hover over the chart area.

Other types of interactions are built into the axes and correspond to gestures, such as dragging to pan or scrolling to zoom. These interactions are separate from those in the axes toolbar.

Note

In R2018a and previous releases, the interaction options appear in the figure toolbar instead of the axes toolbar. Also, in previous releases, none of the gesture-based interactions are built into the axes.

Zoom, Pan, and Rotate Data

Zooming, panning, and rotating the axes let you explore different views of your data. By default, you can scroll or pinch to zoom in and out of the view of the axes. Also, you can drag to pan (2-D view) or drag to rotate (3-D view).

You can enable more interactions by clicking the zoom in , zoom out , pan , and rotate buttons in the axes toolbar. For example, click the zoom-in button if you want to drag a rectangle to zoom into a region of interest.

Display Data Values Using Data Tips

To identify the values of data points in your chart, create data tips. Data tips appear temporarily as you hover over the data points in your chart. To display persistent (pinned) data tips, click one or more data points. Alternatively, select the data tips button in the axes toolbar and then click a data point. To pin multiple data tips using the data tips button, hold down the Shift key. To bring a data tip in front of other data tips that overlap with it, click on it.

Note

In MATLAB® Online™, you might experience some differences in data tip interactivity. For example, in some cases, you cannot pin multiple data tips or edit data tip content.

Select and Modify Data Values Using Data Brushing

You can use data brushing to select, remove, or replace individual data values. To brush data, select the data brushing button from the axes toolbar. Click a data point to highlight it or drag a rectangle to highlight all the data points within the rectangle. Use the Shift key to highlight additional data points.

After you highlight the desired data points, you can use the options in the right-click context menu to remove, replace, or copy the values. The displayed plot shows your changes. Also, you see the updates to the data properties of the plotted object update (such as XData). However, the original workspace variables are not updated. Then, if you want to update the workspace variables as well, you can use the Link option on the figure Tools menu to link the variables to the plot.

Remove Outliers from Plotted Data

This example shows how to use data brushing to delete an outlier from a plot of 100 data points.

First, plot the data containing a single outlier. Then, select the data brushing button from the axes toolbar and drag a rectangle around the outlier.

x = linspace(0,10);
y = exp(.1*x).*sin(3*x);
y(60) = 2.7;
plot(x,y)

Right-click the brushed data point and select Remove from the context menu. Notice that the plot updates. However, the workspace variable does not change.

If you want to remove the point from the workspace variable, then select the Link option from the figure Tools menu before brushing the data.

Customize Plots Using Property Inspector

You can modify plots interactively by using the Property Inspector. When you open the Property Inspector and select a plot, the inspector displays a list of properties that you can edit. To open the inspector, use the inspect function or click the Property Inspector button on the figure toolbar.

See Also

| | | | | |

Related Topics