matlab中各种颜色的表示什么区别,在Matlab中使用不同的颜色

scatter(X,Y,S,C) displays colored circles at the locations specified

by the vectors X and Y (which must be the same size).

S determines the area of each marker (specified in points^2). S can be

a vector the same length as X and Y or a scalar. If S is a scalar,

MATLAB draws all the markers the same size. If S is empty, the default

size is used.

C determines the color of each marker. When C is a vector the same

length as X and Y, the values in C are linearly mapped to the colors

in the current colormap. When C is a 1-by-3 matrix, it specifies the

colors of the markers as RGB values. If you have 3 points in the

scatter plot and wish to have the colors be indices into the colormap,

C should be a 3-by-1 matrix. C can also be a color string (see

ColorSpec for a list of color string specifiers).

因此,例如,假设您的聚类由矩阵X和Y的列给出,第k列是第k个聚类,X是X坐标,Y是Y坐标。我们可以按照以下方式做你想做的事:

% make some random data in clusters:

n = 15;

m = 42;

X = 0.2*rand(m,n) + repmat(rand(1,n),m,1);

Y = 0.2*rand(m,n) + repmat(rand(1,n),m,1);

% lets change the colour map:

colormap(jet);

% now plot each, one at a time, and each with a different colour:

hold on;

for k=1:n

scatter(X(:,k),Y(:,k),40,k/n*ones(m,1));

end如果你不喜欢这些颜色,你可以改变颜色图,如果你不喜欢颜色图,你可以像其他答案所指出的那样插入你想要的任何RGB值。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值