caxis

Gets or sets the color limits of the current axes.

Category: Other public functions: graph3d

Syntax

caxis([cmin cmax])

Maps colors so that cmin is the first color of the colormap and cmax the last.

lims = caxis

Returns the current limits as a two-element vector.

caxis auto, caxis manual

Lets the limits follow the data again, or freezes them.

Description

Surfaces, images and patches pick their colors by scaling their data into the colormap. The color limits set the data values at the two ends of that scale; values outside are drawn with the end colors. Narrowing the limits increases contrast around the values of interest, and using the same limits on several plots makes their colors comparable.

caxis is the older name of clim, which does the same thing.

Input arguments

[cmin cmax]
Two increasing values.

Output arguments

lims
Two-element vector [cmin cmax].

Example

Fix the color range

surf(peaks(20))
caxis([-3 3])
lims = caxis
Output
lims = 1×2

    -3     3

See also

colormap colorbar surf imagesc clim