Main Content

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.

Sample axes toolbar

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

缩放,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 rotatebuttons 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 buttonin the axes toolbar and then click a data point. To pin multiple data tips using the data tips button, hold down theShiftkey. To bring a data tip in front of other data tips that overlap with it, click on it.

Surface plot with two pinned data tips. The data tips show x, y, and z coordinates.

Note

InMATLAB®Online™, you might experience some differences in data tip interactivity. For example, in some cases, you cannot click to bring a data tip in front of other data tips that overlap with it.

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 buttonfrom the axes toolbar. Click a data point to highlight it or drag a rectangle to highlight all the data points within the rectangle. Use theShiftkey 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 asXData). However, the original workspace variables are not updated. Then, if you want to update the workspace variables as well, you can use theLinkoption on the figureToolsmenu 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 buttonfrom 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)

A line plot with a rectangle surrounding the outlier. The outlier is displayed using red circle marker.

Right-click the brushed data point and selectRemovefrom 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 theLinkoption from the figureToolsmenu before brushing the data.

Customize Plots Using Property Inspector

You can modify plots interactively by using theProperty 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 theinspectfunction or click the Property Inspector buttonon the figure toolbar.

的窗口。一个图我s on the left and the Property Inspector is on the right.

See Also

||||||

Related Topics