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 interactions 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 3D 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. When an interaction mode is enabled, interact with the axes by using the mouse. Some modes support interacting with the axes by using the scroll wheel or the keyboard. For example, in pan mode, to pan vertically, press the up arrow (↑) or down arrow (↓) key; to pan horizontally, press the left arrow (←) or right arrow (→) key.
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 it. For some charts, to move the currently selected data tip to another data point, use the arrow keys.
Note
In MATLAB® 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 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
brush
| datacursormode
| rotate3d
| pan
| zoom
| linkdata
| Property Inspector