Next: , Up: Two-Dimensional Plots   [Contents][Index]


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.

: 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 (…, option)
: 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 automatically be computed based on the data in the axis.

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. For example,

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

forces a square aspect ratio, and

axis ("tic", "labely");

turns tick marks on for all axes and tick mark labels on for the y-axis only.

The following options control the aspect ratio of the axes.

"square"

Force a square axis aspect ratio.

"equal"

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

"normal"

Restore default aspect ratio.

The following options control the way axis limits are interpreted.

"auto[xyz]"

Set the specified axes to have nice limits around the data or all if no axes are specified.

"manual"

Fix the current axes limits.

"tight"

Fix axes to the limits of the data.

"image"

Equivalent to "tight" and "equal".

The following options affect the appearance of tick marks.

"on"

Turn tick marks and labels on for all axes.

"off"

Turn tick marks off for all axes.

"tic[xyz]"

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

"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.

Note, if there are no tick marks for an axis, there can be no labels.

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

"ij"

Reverse y-axis, so lower values are nearer the top.

"xy"

Restore y-axis, so higher values are nearer the top.

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

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

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

: caxis ([cmin cmax])
: caxis ("auto")
: caxis ("manual")
: caxis (hax, …)
: limits = caxis ()

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 axis rather than the current axes returned by gca.

Called without arguments the current color axis limits are returned.

See also: colormap.

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")
: xlim ([x_lo x_hi])
: xlim ("auto")
: xlim ("manual")
: 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".

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 current plotting mode can be changed by using either "auto" or "manual" as the argument.

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

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


Next: , Up: Two-Dimensional Plots   [Contents][Index]