colormap
View and set current colormap
Syntax
Description
Set Colormap
colormap
sets the colormap for
the current figure to the specified predefined colormap. For example,
map
colormap hot
sets the colormap to
hot
.
If you set the colormap for the figure, then axes and charts in the figure use the same colormap. The new colormap is the same length (number of colors) as the current colormap. When you use this syntax, you cannot specify a custom length for the colormap. See the More About section for more information about colormaps.
sets the colormap and returns it as a three-column matrix of RGB triplets.
Specify cmap
= colormap(___)cmap
as an output argument with any of the previous
syntaxes that use parentheses.
Examples
Input Arguments
Output Arguments
More About
Tips
To control the limits of the colormap, and how those limits relate to the range of your data, use the
clim
function.Before R2022a: Use
caxis
, which has the same syntaxes and arguments asclim
.