MATLAB Colormap: Usage Guide
The colormap function is used to set and retrieve the color mapping of the current image. It can be used to alter the way colors are displayed in the image.
The syntax is:
colormap(map)
Where map can be one of the following forms:
- Predefined color mapping names such as ‘hot’, ‘gray’, and ‘cool’.
- A matrix of size n×3 representing a custom color mapping, where each row is an RGB color value ranging from 0 to 1.
- A vector of size n representing custom color indices must have values between 1 and n.
- ‘restore’ the color mapping to the default linear grayscale mapping.
Once the color mapping is set, the subsequent images will be displayed in colors according to this mapping. The colormap function allows for flexible control over the color mapping of the image.