Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2026.0.0 - Français


colormap

set and/or get a figure/axes colormap.

Syntax

cmap = colormap()
cmap = colormap(h)

cmap = colormap(m)
cmap = colormap(h, m)

colormap(m)
colormap(h, m)

Arguments

h

A figure or axes handle. If not given the current figure is used (See gcf).

m

A string (function name), a function, a Nx3 double matrix or "default" (to reset colormap to the default one). The color map to be used.

Description

colormap function is a helper to manage colormaps.

cmap = colormap() returns the current figure colormap.

cmap = colormap(h) returns the colormap of the figure/axes handle h.

[cmap =] colormap(m) sets the colormap m to the current figure. cmap is only returned when the output of the function is assigned.

[cmap =] colormap(h, m) sets the colormap m to the figure/axes handle h. cmap is only returned when the output of the function is assigned.

Examples

x = %pi * [-1:0.05:1]';
z = sin(x)*cos(x)';

f=scf();
// Change colormap to parula (32 values)
colormap(parula(32));

ax1 = subplot(1, 2, 1);
ax1.title.text = "plot3d() using figure colormap";
e = plot3d(x, x, z, 70, 70);
e.color_flag = 1;

ax2 = subplot(1, 2, 2);
ax2.title.text = "plot3d() using axes colormap"
// Change colormap to jet (default size)
colormap(ax2, jet); // Equivalent to colormap(ax2, "jet")
e = plot3d(x, x, z, 70, 70);
e.color_flag = 1;

See also

History

VersionDescription
2024.1.0 Function colormap introduced.
2026.0.0 Axes handles are now managed as input.
Report an issue
<< Palettes de couleurs Palettes de couleurs Using colormaps >>

Copyright (c) 2022-2025 (Dassault Systèmes S.E.)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Oct 16 09:08:43 CEST 2025