Main Content

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

lines

线条颜色图数组

  • Lines colormap

说明

c = lines 以一个三列数组的形式返回线条颜色图,该数组包含的行数与当前图窗 (gcf) 的颜色图相同。如果不存在图窗,则数组包含 256 行。数组中的每一行包含一种特定颜色的红、绿、蓝强度。强度在 [0,1] 范围内,颜色方案与 Axes 的默认 ColorOrder 属性匹配。因此,您可以使用此颜色图使图形颜色与 plot 函数的输出匹配。

Sample of the lines colormap

示例

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

示例

全部折叠

使用默认颜色创建散点图。

x = [3.5 3.3 5 6.1 4 2];
y = [14 5.7 12 6 8 9];
sz = 100*[6 100 20 3 15 20];
c = [1 2 3 4 5 6];
scatter(x,y,sz,c,'filled','MarkerEdgeColor','k','MarkerFaceAlpha',.7);
xlim([1 7]);
ylim([1 16]);

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

获取具有六个条目的线条颜色图数组。然后替换散点图中的颜色图。

c = lines(6);
colormap(c);

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

输入参数

全部折叠

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

数据类型: single | double

版本历史记录

在 R2006a 之前推出

全部展开