# zlim

Set or query *z*-axis limits

## Syntax

## Description

### Specify Limits

`zlim(`

sets
the `limits`

)*z*-axis limits for the current axes. Specify `limits`

as
a two-element vector of the form `[zmin zmax]`

, where `zmax`

is
greater than `zmin`

.

`zlim(`

specifies the
limit method MATLAB`limitmethod`

)^{®} uses for automatic limit selection. Specify the limit method as
`"tickaligned"`

, `"tight"`

, or
`"padded"`

. MATLAB sets the `ZLimitMethod`

property of the axes to
the value you specify.

You can specify the `limitmethod`

argument without
parentheses. For example, `zlim tight`

enables tight
*z*-axis limits.

`zlim(`

specifies automatic
or manual limit selection. The `limitmode`

)`limitmode`

can have either of
two values:

`"auto"`

— Enable automatic limit selection. MATLAB selects the limits based on the range of your data and the value of the`ZLimitMethod`

property of the axes. If you plot into the axes multiple times, the limits update to encompass all the data.`"manual"`

— Freeze the*z*-axis limits at their current value.

You can specify the `limitmode`

argument without
parentheses. For example, `zlim auto`

enables automatic limit
selection.

### Query Limits

returns
the current `limmethod`

= zlim("method")*z*-axis limits method, which can be
`'tickaligned'`

, `'tight'`

, or
`'padded'`

.

returns the current
`limmode`

= zlim("mode")*z*-axis limits mode, which is either
`'auto'`

or `'manual'`

. By default, the
mode is automatic unless you specify limits or set the mode to manual.

### Specify Target Axes or Chart

`___ = zlim(`

uses the axes specified by `ax`

,___)`ax`

instead of the current axes.
Specify `ax`

as the first input argument for any of the
previous syntaxes. You can include an output argument if the original syntax
supports an output argument. Use quotes around the mode inputs, for example,
`zlim(ax,"auto")`

.

## Examples

## Input Arguments

## Output Arguments

## Algorithms

The `zlim`

function sets and queries several
axes properties related to the *z*-axis limits.

`ZLim`

— Property that stores the*z*-axis limits.`ZLimMode`

— Property that stores the*z*-axis limits mode. When you set the*z*-axis limits, this property changes to`"manual"`

.`ZLimitMethod`

— Property that controls how the*z*-axis limits are calculated when the`ZLimMode`

property is set to`"auto"`

.

## Version History

**Introduced before R2006a**