matlab中scatter3函数能不能设置每个点的颜色

如题所述

可以的,只要数据个数与点数相等就行,如:
[x,y,z]
=
sphere(16);
x
=
[x(:)*.5
x(:)*.75
x(:)];
y
=
[y(:)*.5
y(:)*.75
y(:)];
z
=
[z(:)*.5
z(:)*.75
z(:)];
s
=
repmat([1
.75
.5]*10,numel(x),1);
c
=
rand(numel(x),1);
scatter3(x(:),y(:),z(:),s(:),c(:),'filled'),
view(-60,60)
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答
大家正在搜