Main Content

本页翻译不是最新的。点击此处可查看最新英文版本。

colorcube

Colorcube 颜色图数组

  • Colorcube colormap

说明

示例

c = colorcube 以三列数组形式返回 colorcube 颜色图,其中包含的行数与当前图窗 (gcf) 的颜色图相同。如果不存在图窗,则行数等于默认长度 256。数组中的每一行包含一种特定颜色的红、绿、蓝强度。强度介于 [0,1] 范围内,颜色方案如下图所示。

Sample of the colorcube colormap

示例

c = colorcube(m) 返回包含 m 种颜色的颜色图。

示例

全部折叠

获取颜色图数组后,您可以隔离一部分用作颜色方案。

创建平面的曲面图。

[X,Y] = meshgrid(-10:1:10);
Z = X + Y;
surf(X,Y,Z);

Figure contains an axes object. The axes object contains an object of type surface.

获取 colorcube 颜色图数组,并隔离红色部分(条目 39 到 44)。然后使用此部分为整个曲面着色。

c = colorcube;
c = c(39:44,:);
colormap(c);

Figure contains an axes object. The axes object contains an object of type surface.

创建平面的曲面图。

[X,Y] = meshgrid(-10:1:10);
Z = X + Y;
surf(X,Y,Z);

Figure contains an axes object. The axes object contains an object of type surface.

获取包含 75 个条目的 colorcube 颜色图,然后使用它为平面着色。

c = colorcube(75);
colormap(c);

Figure contains an axes object. The axes object contains an object of type surface.

输入参数

全部折叠

颜色数,指定为非负整数。m 的默认值为当前图窗的颜色图中的颜色数。如果不存在图窗,则默认值为 256

数据类型: single | double

版本历史记录

在 R2006a 之前推出

全部展开