zoom
Enable zoom mode
Description
You can use zoom mode to explore data by interactively changing the limits of
axes. Enable or disable zoom mode, and set other basic options, by using the
zoom
function. To further control zoom mode behavior, return and use a
zoom
object.
Most charts support zoom mode, including line, bar, histogram, and surface charts. Charts that support zoom mode typically display the zoom in and zoom out icons in the axes toolbar.
You can also interactively explore data using built-in axes interactions that are enabled by default. For example, you can zoom in and out of the view of the axes by scrolling or pinching. Built-in interactions do not require you to enable an interaction mode and respond faster than interaction modes. However, you can enable zoom mode to customize the zooming behavior. For more information about built-in interactions, see Control Chart Interactivity.
Creation
Description
zoom
sets the zoom mode for all
axes in the current figure. For example, option
zoom on
enables zoom mode,
zoom xon
enables zoom mode for the x-dimension
only, and zoom off
disables zoom mode.
When zoom mode is enabled, zoom the view of the axes using the cursor, the scroll wheel, or the keyboard.
Cursor — To zoom in, position your cursor where you want the center of the axes to be and click. To zoom out, hold Shift and click. To zoom into a rectangular region, click and drag. To return an axes object to its baseline zoom level, double-click within the axes.
Scroll wheel — To zoom in, scroll up. To zoom out, scroll down.
Keyboard — To zoom in, press the up arrow (↑) key. To zoom out, press the down arrow (↓) key.
Some built-in interactions remain enabled by default, regardless of the current
interaction mode. To disable built-in zoom interactions that are independent of the zoom
mode, use the disableDefaultInteractivity
function.
zoom
toggles the zoom mode. If zoom mode is disabled, then
calling zoom
restores the most recently used zoom option of
on
, xon
, or yon
.
zoom(
zooms the current axes by the
specified zoom factor without affecting the zoom mode. Zoom in by specifying
factor
)factor
as a value greater than 1, for example,
zoom(3)
. Zoom out by specifying factor
as a
value between 0 and 1, for example, zoom(0.5)
.
zoom(
sets the zoom
mode for all axes in the specified figure for any of the previous syntaxes. Specify the
additional argument as a zoom mode option or a zoom factor. For example, to enable zoom
mode for all axes in the figure fig
,___)fig
, use
zoom(fig,'on')
. To zoom all of the axes by a factor of 2, use
zoom(fig,2)
.
zoom(
sets the zoom mode
for the specified axes. Specify the additional argument as a zoom mode option or a zoom
factor. For example, to enable zoom mode for the axes ax
,___)ax
, use
zoom(ax,'on')
. To zoom the axes ax
by a factor
of 2, use zoom(ax,2)
. Use this syntax with apps created in App
Designer and using the uifigure
function. (since R2023a)
Input Arguments
Properties
Object Functions
Use zoom object functions to customize the zooming behavior of axes objects within a figure. For all of these functions, the axes and zoom objects must be associated with the same figure.
| The Calling Enabling zoom mode for axes using
|
| The Calling Returning the zoom
mode of axes using |
| The Calling
Setting the zoom dimension for
axes using |
| The Calling Returning the zoom dimension of axes using
|
| The Calling For more information about the camera view angle, see Camera Graphics Terminology. |
| The Calling |
| This function is not recommended. Use
Calling
The axes
zoom dimension that is set by |
| This function is not recommended. Use
Calling The axes zoom dimension that is returned using
|
Examples
More About
Alternative Functionality
Axes Toolbar
For some charts, enable zoom mode by clicking the zoom in or zoom out icons in the axes toolbar.