colormap
View and set current colormap.
📝Syntax
colormap(map)
colormap(target ,map)
cmap = colormap()
cmap = colormap(target) 
📥Input Arguments
Parameter Description
map colormap name, 'default' or RGB triplets (matrix).
target Target: figure or axes.
📤Output Arguments
Parameter Description
cmap Colormap values: RGB triplets (matrix).
📄Description

colormap allows to view and set the colormap used into a plot.

💡Examples
f = figure()
x = linspace(-1, 1, 1024)' * ones(1, 1024);
y = x';
Z = exp(-(x .^ 2 + y .^ 2) / 0.4);
imagesc(Z);
colormap('summer')
Example illustration
f = figure()
x = linspace(-1, 1, 1024)' * ones(1, 1024);
y = x';
Z = exp(-(x .^ 2 + y .^ 2) / 0.4);
imagesc(Z);
colormap('gray')
Example illustration
f = figure()
x = linspace(-1, 1, 1024)' * ones(1, 1024);
y = x';
Z = exp(-(x .^ 2 + y .^ 2) / 0.4);
imagesc(Z);

map = [0 0 0.3;
    0 0 0.4;
    0 0 0.5;
    0 0 0.6;
    0 0 0.8;
    0 0 1.0];
colormap(map)
Example illustration
🔗See Also
rgbplot
🕔Version History
Version Description
1.0.0 initial version
Edit this page on GitHub