This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

Zooming in Graphs

Zooming in 2-D and 3-D

Zooming changes the magnification of a graph without changing the size of the figure or axes. Zooming is useful to see greater detail in a small area. As explained below, zooming behaves differently depending on whether it is applied to a 2-D or 3-D view.

Enable zooming by clicking one of the zoom icons . Select + to zoom in and to zoom out.

    Tip   When in zoom in mode, you can use Shift+click to zoom out (i.e., press and hold down the Shift key while clicking the mouse). You can also right-click and zoom out or restore the plot to its original view using the context menu.

Zooming in 2-D Views

In 2-D views, click the area of the axes where you want to zoom in, or drag the cursor to draw a box around the area you want to zoom in on. MATLAB® redraws the axes, changing the limits to display the specified area.

When you right-click in Zoom mode, the context menu enables you to:

  • Zoom out

  • Reset to the view of the graph when it was plotted (undo one or more changes of view)

  • Constrain zooming to expand only the x-axis (horizontal zoom)

  • Constrain zooming to expand only the y-axis (vertical zoom)

Undoing Zoom Actions

If you want to reset the graph to its original view, right-click to display the context menu and select Reset to Original View. You can also use the Undo item on the Edit menu to undo each operation you performed on your graph.

Zoom Constrained to Horizontal or Vertical

In 2-D views, you can constrain zoom to operate in either the horizontal or vertical direction. To do this, right-click to display the context menu while in zoom mode and select the desired constraint from the Zoom Options submenu, as illustrated in the previous figure. Horizontal zooming is useful for exploring time series graphs that have dense intervals. Vertical zooming can help you see minor variations in places where the YData range is small compared to the y-axis limits.

Zooming in 3-D Views

In 3-D views, moving the cursor up or to the right zooms in, while moving the cursor down or to the left zooms out. Both toolbar icons enable the same behavior.

Zooming shifts the view of the data by modifying the axis limits. For axes in a 3-D view, if you want zooming to modify camera properties of the axes instead, then right-click the axes when in zoom mode and select 3D Options > Camera Pan and Zoom.

Was this topic helpful?