MATLAB Function Reference    
colorbar

Display colorbar showing the color scale

Syntax

Description

The colorbar function displays the current colormap in the current figure and resizes the current axes to accommodate the colorbar.

colorbar updates the most recently created colorbar or, when the current axes does not have a colorbar, colorbar adds a new vertical colorbar.

colorbar('vert') adds a vertical colorbar to the current axes.

colorbar('horiz') adds a horizontal colorbar to the current axes.

colorbar(h) uses the axes h to create the colorbar. The colorbar is horizontal if the width of the axes is greater than its height, as determined by the axes Position property.

h = colorbar(...) returns a handle to the colorbar, which is an axes graphics object.

colorbar(...,'peer',axes_handle) creates a colorbar associated with the axes axes_handle instead of the current axes.

Remarks

colorbar works with two-dimensional and three-dimensional plots.

Examples

Display a colorbar beside the axes.

See Also

colormap

Color Operations for related functions


  colmmd colordef