#### 15.2.1.1 Axis Configuration ¶

The axis function may be used to change the axis limits of an existing plot and various other axis properties, such as the aspect ratio and the appearance of tic marks. By default, high level plotting functions such as `plot` reset axes properties. Any customization of properties, for example by calling `axis`, `xlim`, etc., should happen after the plot is done or, alternatively, after calling the hold function.

axis `()` ¶
axis `([x_lo x_hi])` ¶
axis `([x_lo x_hi y_lo y_hi])` ¶
axis `([x_lo x_hi y_lo y_hi z_lo z_hi])` ¶
axis `([x_lo x_hi y_lo y_hi z_lo z_hi c_lo c_hi])` ¶
axis `(option)` ¶
axis `(option1, option2, …)` ¶
axis `(hax, …)` ¶
`limits =` axis `()` ¶

  Set axis limits and appearance.

  The argument limits should be a 2-, 4-, 6-, or 8-element vector. The first and second elements specify the lower and upper limits for the x-axis. The third and fourth specify the limits for the y-axis, the fifth and sixth specify the limits for the z-axis, and the seventh and eighth specify the limits for the color axis. The special values `-Inf` and `Inf` may be used to indicate that the limit should be automatically computed based on the data in the axes.

  Without any arguments, `axis` turns autoscaling on.

  With one output argument, `limits = axis` returns the current axis limits.

  The vector argument specifying limits is optional, and additional string arguments may be used to specify various axis properties.

  The following options control the aspect ratio of the axes.

  `"equal"`

    Force x-axis unit distance to equal y-axis (and z-axis) unit distance.

  `"square"`

    Force a square axis aspect ratio.

  `"vis3d"`

    Set aspect ratio modes (`"DataAspectRatio"`, `"PlotBoxAspectRatio"`) to `"manual"` for rotation without stretching.

  `"normal"`
  `"fill"`

    Restore default automatically computed aspect ratios.

  The following options control the way axis limits are interpreted.

  `"auto"`
  `"auto[xyz]"`
  `"auto [xyz]"`

    Set nice auto-computed limits around the data for all axes, or only the specified axes.

  `"manual"`

    Fix the current axes limits.

  `"tickaligned"`

    Fix axes to the limits of the closest ticks.

  `"tight"`

    Fix axes to the limits of the data.

  `"padded"`

    Fix axes to the limits of the data plus margins of about 7% of the data extent.

  `"image"`

    Equivalent to `"tight"` and `"equal"`.

  The following options affect the appearance of tick marks.

  `"tic"`
  `"tic[xyz]"`
  `"tic [xyz]"`

    Turn tick marks on for all axes, or turn them on for the specified axes and off for the remainder.

  `"label"`
  `"label[xyz]"`
  `"label [xyz]"`

    Turn tick labels on for all axes, or turn them on for the specified axes and off for the remainder.

  `"nolabel"`

    Turn tick labels off for all axes.

  The following options affect the direction of increasing values on the axes.

  `"xy"`

    Default y-axis, larger values are near the top.

  `"ij"`

    Reverse y-axis, smaller values are near the top.

  The following options affects the visibility of the axes.

  `"on"`

    Make the axes visible.

  `"off"`

    Hide the axes.

  If the first argument hax is an axes handle, then operate on this axes rather than the current axes returned by `gca`.

  Example 1: set X/Y limits and force a square aspect ratio

      axis ([1, 2, 3, 4], "square");

  Example 2: enable tick marks on all axes, enable tick mark labels only on the y-axis

      axis ("tic", "labely");

  See also: xlim, ylim, zlim, clim, daspect, pbaspect, box, grid.

Similarly the axis limits of the colormap can be changed with the `clim` function.

clim `([cmin cmax])` ¶
clim `("auto")` ¶
clim `("manual")` ¶
clim `(hax, …)` ¶
`limits =` clim `()` ¶

  Query or set color axis limits for plots.

  The limits argument should be a 2-element vector specifying the lower and upper limits to assign to the first and last value in the colormap. Data values outside this range are clamped to the first and last colormap entries.

  If the `"auto"` option is given then automatic colormap limits are applied. The automatic algorithm sets cmin to the minimum data value and cmax to the maximum data value. If `"manual"` is specified then the `"climmode"` property is set to `"manual"` and the numeric values in the `"clim"` property are used for limits.

  If the first argument hax is an axes handle, then operate on this axes rather than the current axes returned by `gca`.

  Called without arguments the current color axis limits are returned.

  Programming Note: The color axis affects the display of image, patch, and surface graphics objects, but only if the `"cdata"` property has indexed data and the `"cdatamapping"` property is set to `"scaled"`. Graphic objects with true color `cdata`, or `"direct"` `cdatamapping` are not affected.

  See also: colormap, axis.

The `xlim`, `ylim`, and `zlim` functions may be used to get or set individual axis limits. Each has the same form.

`xlimits =` xlim `()` ¶
`xmode =` xlim `("mode")` ¶
`xmethod =` xlim `("method")` ¶
xlim `([x_lo x_hi])` ¶
xlim `("mode")` ¶
xlim `("method")` ¶
xlim `(hax, …)` ¶

  Query or set the limits of the x-axis for the current plot.

  Called without arguments `xlim` returns the x-axis limits of the current plot.

  With the input query `"mode"`, return the current x-limit calculation mode which is either `"auto"` or `"manual"`.

  With the input query `"method"`, return the current x-limit calculation method which is either `"tickaligned"`, `"tight"`, or `"padded"`.

  If passed a 2-element vector [x_lo x_hi], the limits of the x-axis are set to these values and the mode is set to `"manual"`. The special values -Inf and Inf can be used to indicate that either the lower axis limit or upper axis limit should be automatically calculated.

  The current limit calculation `"mode"` may be one of

  `"auto"` (default)

    Automatically calculate limits based on the plot data and the currently specified limit calculation method.

  `"manual"`

    Fix axis limits at current values.

  The current limit calculation method may be one of

  `"tickaligned"` (default)

    Calculate limits that encompass all of the data and extend outwards to the nearest tick mark.

  `"tight"`

    Calculate limits that exactly fit the data range.

  `"padded"`

    Calculate limits that leave a margin around the data of approximately 7% of the data range.

  If the first argument hax is an axes handle, then operate on this axes rather than the current axes returned by `gca`.

  Programming Note: The `xlim` function operates by modifying the `"xlim"`, `"xlimmode"`, and `"xlimitmethod"` properties of an axes object. These properties can be directly inspected and altered with `get`/`set`.

  See also: ylim, zlim, axis, set, get, gca.

`ylimits =` ylim `()` ¶
`ymode =` ylim `("mode")` ¶
`ymethod =` ylim `("method")` ¶
ylim `([y_lo y_hi])` ¶
ylim `("mode")` ¶
ylim `("method")` ¶
ylim `(hax, …)` ¶

  Query or set the limits of the y-axis for the current plot.

  Called without arguments `ylim` returns the y-axis limits of the current plot.

  With the input query `"mode"`, return the current y-limit calculation mode which is either `"auto"` or `"manual"`.

  With the input query `"method"`, return the current y-limit calculation method which is either `"tickaligned"`, `"tight"`, or `"padded"`.

  If passed a 2-element vector [y_lo y_hi], the limits of the y-axis are set to these values and the mode is set to `"manual"`. The special values -Inf and Inf can be used to indicate that either the lower axis limit or upper axis limit should be automatically calculated.

  The current limit calculation `"mode"` may be one of

  `"auto"` (default)

    Automatically calculate limits based on the plot data and the currently specified limit calculation method.

  `"manual"`

    Fix axis limits at current values.

  The current limit calculation method may be one of

  `"tickaligned"` (default)

    Calculate limits that encompass all of the data and extend outwards to the nearest tick mark.

  `"tight"`

    Calculate limits that exactly fit the data range.

  `"padded"`

    Calculate limits that leave a margin around the data of approximately 7% of the data range.

  If the first argument hax is an axes handle, then operate on this axes rather than the current axes returned by `gca`.

  Programming Note: The `ylim` function operates by modifying the `"ylim"`, `"ylimmode"`, and `"ylimitmethod"` properties of an axes object. These properties can be directly inspected and altered with `get`/`set`.

  See also: xlim, zlim, axis, set, get, gca.

`zlimits =` zlim `()` ¶
`zmode =` zlim `("mode")` ¶
`zmethod =` zlim `("method")` ¶
zlim `([z_lo z_hi])` ¶
zlim `("mode")` ¶
zlim `("method")` ¶
zlim `(hax, …)` ¶

  Query or set the limits of the z-axis for the current plot.

  Called without arguments `zlim` returns the z-axis limits of the current plot.

  With the input query `"mode"`, return the current z-limit calculation mode which is either `"auto"` or `"manual"`.

  With the input query `"method"`, return the current z-limit calculation method which is either `"tickaligned"`, `"tight"`, or `"padded"`.

  If passed a 2-element vector [z_lo z_hi], the limits of the z-axis are set to these values and the mode is set to `"manual"`. The special values -Inf and Inf can be used to indicate that either the lower axis limit or upper axis limit should be automatically calculated.

  The current limit calculation `"mode"` may be one of

  `"auto"` (default)

    Automatically calculate limits based on the plot data and the currently specified limit calculation method.

  `"manual"`

    Fix axis limits at current values.

  The current limit calculation method may be one of

  `"tickaligned"` (default)

    Calculate limits that encompass all of the data and extend outwards to the nearest tick mark.

  `"tight"`

    Calculate limits that exactly fit the data range.

  `"padded"`

    Calculate limits that leave a margin around the data of approximately 7% of the data range.

  If the first argument hax is an axes handle, then operate on this axes rather than the current axes returned by `gca`.

  Programming Note: The `zlim` function operates by modifying the `"zlim"`, `"zlimmode"`, and `"zlimitmethod"` properties of an axes object. These properties can be directly inspected and altered with `get`/`set`.

  See also: xlim, ylim, axis, set, get, gca.

The `xticks`, `yticks`, `zticks`, `rticks`, and `thetaticks` functions may be used to get or set the tick mark locations and modes on the respective axis. Each has the same form, although mode options are not currently available for `rticks`, and `thetaticks`.

`tickval =` xticks ¶
`mode =` xticks `("mode")` ¶
xticks `(tickval)` ¶
xticks `("auto")` ¶
xticks `("manual")` ¶
`… =` xticks `(hax, …)` ¶

  Query or set the tick values on the x-axis of the current axis.

  When called without an argument, return the current tick locations as specified in the `"xtick"` axes property. These locations can be changed by calling `xticks` with a vector of tick values. Note: ascending order is not required.

  When called with argument `"mode"`, `xticks` returns the current value of the axes property `"xtickmode"`. This property can be changed by calling `xticks` with either `"auto"` (algorithm determines tick positions) or `"manual"` (tick values remain fixed regardless of axes resizing or rotation). Note: Specifying xtick values will also set the property `"xtickmode"` to `"manual"`.

  If the first argument hax is an axes handle, then operate on this axis rather than the current axes returned by `gca`.

  Requesting a return value when calling `xticks` to set a property value will result in an error.

  See also: xticklabels, yticks, zticks, rticks, thetaticks, get, set.

`tickval =` yticks ¶
`mode =` yticks `("mode")` ¶
yticks `(tickval)` ¶
yticks `("auto")` ¶
yticks `("manual")` ¶
`… =` yticks `(hax, …)` ¶

  Query or set the tick values on the y-axis of the current axis.

  When called without an argument, return the current tick locations as specified in the `"ytick"` axes property. These locations can be changed by calling `yticks` with a vector of tick values. Note: ascending order is not required.

  When called with argument `"mode"`, `yticks` returns the current value of the axes property `"ytickmode"`. This property can be changed by calling `yticks` with either `"auto"` (algorithm determines tick positions) or `"manual"` (tick values remain fixed regardless of axes resizing or rotation). Note: Specifying ytick values will also set the property `"ytickmode"` to `"manual"`.

  If the first argument hax is an axes handle, then operate on this axis rather than the current axes returned by `gca`.

  Requesting a return value when calling `yticks` to set a property value will result in an error.

  See also: yticklabels, xticks, zticks, rticks, thetaticks, get, set.

`tickval =` zticks ¶
`mode =` zticks `("mode")` ¶
zticks `(tickval)` ¶
zticks `("auto")` ¶
zticks `("manual")` ¶
`… =` zticks `(hax, …)` ¶

  Query or set the tick values on the z-axis of the current axis.

  When called without an argument, return the current tick locations as specified in the `"ztick"` axes property. These locations can be changed by calling `zticks` with a vector of tick values. Note: ascending order is not required.

  When called with argument `"mode"`, `zticks` returns the current value of the axes property `"ztickmode"`. This property can be changed by calling `zticks` with either `"auto"` (algorithm determines tick positions) or `"manual"` (tick values remain fixed regardless of axes resizing or rotation). Note: Specifying ztick values will also set the property `"ztickmode"` to `"manual"`.

  If the first argument hax is an axes handle, then operate on this axis rather than the current axes returned by `gca`.

  Requesting a return value when calling `zticks` to set a property value will result in an error.

  See also: zticklabels, xticks, yticks, rticks, thetaticks, get, set.

`tickval =` rticks ¶
rticks `(tickval)` ¶
`… =` rticks `(hax, …)` ¶

  Query or set the tick values on the r-axis of the current axis.

  When called without argument, return the current tick locations as specified in the `"rtick"` axes property. These locations can be changed by calling `rticks` with a vector of tick values. Note: ascending order is not required.

  If the first argument hax is an axes handle, then operate on this axis rather than the current axes returned by `gca`.

  Requesting a return value when calling `rticks` to set a property value will result in an error.

  NOTE: Octave does not currently implement polaraxes objects. It is therefore not possible to query or set a `"mode"` for the `"rtick"` property as can be done with the equivalent functions for x, y, and z axes.

  See also: thetaticks, xticks, yticks, zticks, polar, get, set.

`tickval =` thetaticks ¶
thetaticks `(tickval)` ¶
`… =` thetaticks `(hax, …)` ¶

  Query or set the tick values on the theta-axis of the current axis.

  When called without argument, return the current tick locations as specified in the `"ttick"` axes property. These locations can be changed by calling `thetaticks` with a vector of tick values. Note: ascending order is not required.

  If the first argument hax is an axes handle, then operate on this axis rather than the current axes returned by `gca`.

  Requesting a return value when calling `thetaticks` to set a property value will result in an error.

  NOTE: Octave does not currently implement polaraxes objects. It is therefore not possible to query or set a `"mode"` for the `"thetatick"` property as can be done with the equivalent functions for x, y, and z axes.

  See also: rticks, xticks, yticks, zticks, polar, get, set.

The `xticklabels`, `yticklabels`, and `zticklabels` functions may be used to get or set the label assigned to each tick location and the labeling mode on the respective axis. Each has the same form.

`labels =` xticklabels ¶
`mode =` xticklabels `("mode")` ¶
xticklabels `(tickval)` ¶
xticklabels `("auto")` ¶
xticklabels `("manual")` ¶
`… =` xticklabels `(hax, …)` ¶

  Query or set the tick labels on the x-axis of the current axis.

  When called without an argument, return a cell array of strings of the current tick labels as specified in the `"xticklabel"` axes property. These labels can be changed by calling `xticklabels` with a cell array of strings. Note: a vector of numbers will be mapped to a cell array of strings. If fewer labels are specified than the current number of ticks, blank labels will be appended to the array.

  When called with argument `"mode"`, `xticklabels` returns the current value of the axes property `"xticklabelmode"`. This property can be changed by calling `xticklabels` with either `"auto"` (algorithm determines tick labels) or `"manual"` (tick labels remain fixed). Note: Specifying xticklabel values will also set the `"xticklabelmode"` and `"xticks"` properties to `"manual"`.

  If the first argument hax is an axes handle, then operate on this axis rather than the current axes returned by `gca`.

  Requesting a return value when calling `xticklabels` to set a property value will result in an error.

  See also: xticks, yticklabels, zticklabels, get, set.

`labels =` yticklabels ¶
`mode =` yticklabels `("mode")` ¶
yticklabels `(tickval)` ¶
yticklabels `("auto")` ¶
yticklabels `("manual")` ¶
`… =` yticklabels `(hax, …)` ¶

  Query or set the tick labels on the x-axis of the current axis.

  When called without an argument, return a cell array of strings of the current tick labels as specified in the `"yticklabel"` axes property. These labels can be changed by calling `yticklabels` with a cell array of strings. Note: a vector of numbers will be mapped to a cell array of strings. If fewer labels are specified than the current number of ticks, blank labels will be appended to the array.

  When called with argument `"mode"`, `yticklabels` returns the current value of the axes property `"yticklabelmode"`. This property can be changed by calling `yticklabels` with either `"auto"` (algorithm determines tick labels) or `"manual"` (tick labels remain fixed). Note: Specifying yticklabel values will also set the `"yticklabelmode"` and `"yticks"` properties to `"manual"`.

  If the first argument hax is an axes handle, then operate on this axis rather than the current axes returned by `gca`.

  Requesting a return value when calling `xticklabels` to set a property value will result in an error.

  See also: yticks, xticklabels, zticklabels, get, set.

`labels =` zticklabels ¶
`mode =` zticklabels `("mode")` ¶
zticklabels `(tickval)` ¶
zticklabels `("auto")` ¶
zticklabels `("manual")` ¶
`… =` zticklabels `(hax, …)` ¶

  Query or set the tick labels on the x-axis of the current axis.

  When called without an argument, return a cell array of strings of the current tick labels as specified in the `"zticklabel"` axes property. These labels can be changed by calling `zticklabels` with a cell array of strings. Note: a vector of numbers will be mapped to a cell array of strings. If fewer labels are specified than the current number of ticks, blank labels will be appended to the array.

  When called with argument `"mode"`, `zticklabels` returns the current value of the axes property `"zticklabelmode"`. This property can be changed by calling `zticklabels` with either `"auto"` (algorithm determines tick labels) or `"manual"` (tick labels remain fixed). Note: Specifying zticklabel values will also set the `"zticklabelmode"` and `"zticks"` properties to `"manual"`.

  If the first argument hax is an axes handle, then operate on this axis rather than the current axes returned by `gca`.

  Requesting a return value when calling `xticklabels` to set a property value will result in an error.

  See also: zticks, xticklabels, zticklabels, get, set.

`labels =` rticklabels ¶
rticklabels `(tickval)` ¶
`… =` rticklabels `(hax, …)` ¶

  Query or set the tick labels on the r-axis of a polar plot.

  When called without an argument, return a cell array of strings of the current rtick labels.

  When called with the argument tickval being a vector of numbers or a cell array of strings and/or numbers, the labels will be changed to match these new values. Note that the center point of the plots made by `polar` are never labeled, so the first specified label will be applied to the second rtick location and subsequent labels will progress outward.

  If fewer labels are specified than the current number of tick marks, those labels will be applied starting with the innermost tick labels, and blank labels will be appended to the remainder. If the specified label count exceeds the number of tick labels, the excess labels are ignored.

  If the first argument hax is an axes handle, then operate on this axis rather than the current axes returned by `gca`.

  Requesting a return value when calling `rticklabels` to set a property value will result in an error.

  Compatibility Note: The `'mode'` property for rticklabels has not yet been implemented.

  See also: polar, rticks, thetaticklabels, xticklabels, yticklabels, zticklabels, get, set.

`labels =` thetaticklabels ¶
thetaticklabels `(tickval)` ¶
`… =` thetaticklabels `(hax, …)` ¶

  Query or set the tick labels on the theta-axis of a polar plot.

  When called without an argument, return a cell array of strings of the current ttick labels.

  When called with the argument tickval being a vector of numbers or a cell array of strings and/or numbers, the labels will be changed to match these new values. Values will be applied starting with the zero-degree tick mark and will progress counterclockwise.

  If fewer labels are specified than the current number of theta tick marks, those labels will be applied starting at the zero-degree tick mark and blank labels will be appended to the remainder. If the specified label count exceeds the number of tick labels, the excess labels are ignored.

  If the first argument hax is an axes handle, then operate on this axis rather than the current axes returned by `gca`.

  Requesting a return value when calling `thetaticklabels` to set a property value will result in an error.

  Compatibility Note: The `'mode'` property for thetaticklabels has not yet been implemented.

  See also: polar, thetaticks, rticklabels, xticklabels, yticklabels, zticklabels, get, set.

The `xtickangle`, `ytickangle`, and `ztickangle` functions may be used to get or set the rotation angle of labels for the respective axis. Each has the same form.

`angle =` xtickangle `()` ¶
`angle =` xtickangle `(hax)` ¶
xtickangle `(angle)` ¶
xtickangle `(hax, angle)` ¶

  Query or set the rotation angle of the tick labels on the x-axis of the current axes.

  When called without an argument, return the rotation angle in degrees of the tick labels as specified in the axes property `"XTickLabelRotation"`. When called with a numeric scalar angle, rotate the tick labels counterclockwise to angle degrees.

  If the first argument hax is an axes handle, then operate on this axes rather than the current axes returned by `gca`.

  Programming Notes:

  1. The `"XTickLabelRotation"` property is not currently implemented in Octave. The property can be set and queried, but has no effect on the plot.
  2. Requesting a return value while also setting a specified rotation will result in an error.

  See also: ytickangle, ztickangle, get, set.

`angle =` ytickangle `()` ¶
`angle =` ytickangle `(hax)` ¶
ytickangle `(angle)` ¶
ytickangle `(hax, angle)` ¶

  Query or set the rotation angle of the tick labels on the y-axis of the current axes.

  When called without an argument, return the rotation angle in degrees of the tick labels as specified in the axes property `"YTickLabelRotation"`. When called with a numeric scalar angle, rotate the tick labels counterclockwise to angle degrees.

  If the first argument hax is an axes handle, then operate on this axes rather than the current axes returned by `gca`.

  Programming Notes:

  1. The `"YTickLabelRotation"` property is not currently implemented in Octave. The property can be set and queried, but has no effect on the plot.
  2. Requesting a return value while also setting a specified rotation will result in an error.

  See also: xtickangle, ztickangle, get, set.

`angle =` ztickangle `()` ¶
`angle =` ztickangle `(hax)` ¶
ztickangle `(angle)` ¶
ztickangle `(hax, angle)` ¶

  Query or set the rotation angle of the tick labels on the z-axis of the current axes.

  When called without an argument, return the rotation angle in degrees of the tick labels as specified in the axes property `"ZTickLabelRotation"`. When called with a numeric scalar angle, rotate the tick labels counterclockwise to angle degrees.

  If the first argument hax is an axes handle, then operate on this axes rather than the current axes returned by `gca`.

  Programming Notes:

  1. The `"ZTickLabelRotation"` property is not currently implemented in Octave. The property can be set and queried, but has no effect on the plot.
  2. Requesting a return value while also setting a specified rotation will result in an error.

  See also: xtickangle, ytickangle, get, set.