MATLAB Function Reference |
Display colorbar showing the color scale
Syntax
colorbar colorbar(...,'peer',axes_handle) colorbar(axes_handle) colorbar('location
') colorbar(...,'PropertyName
',propertyvalue) cbar_axes = colorbar(...)
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(...,'peer',axes_handle)
creates a colorbar associated with the axes axes_handle
instead of the current axes.
colorbar(axes_handle)
adds the colorbar to the axes axes_handle
in the default (right
) orientation.
colorbar(...,'
adds a colorbar in the specified orientation with respect to the axes. Possible values for location
')
location
are
North
-- inside plot box near top
South
-- inside bottom
East
-- inside right
West
-- inside left
NorthOutside
-- outside plotbox near top
SouthOutside
-- outside bottom
EastOutside
-- outside right
WestOutside
-- outside left
Using one of the ...Outside
values for location
assure that the colorbar will not overlap the plot, whereas overlaps can occur when you specify any of the other four values.
colorbar(...,'
specifies property names and values for the axes object used to create the colorbar. See axes properties for a description of the properties you can set. The PropertyName
',propertyvalue)
location
property applies only to colorbars and legends, not to axes.
cbar_axes = colorbar(...)
returns a handle to the colorbar, which is an axes graphics object that contains one additional property, Location
.
Remarks
You can use colorbar
with 2-D and 3-D plots.
Examples
Display a colorbar beside the axes and use descriptive text strings as y-tick labels.
surf(peaks(30)) colorbar('YTickLabel',... {'Freezing','Cold','Cool','Neutral','Warm','Hot','Burning'})
See Also
Color Operations for related functions
colmmd | colordef |
© 1994-2005 The MathWorks, Inc.