RGB colors in scatter3
2 次查看(过去 30 天)
显示 更早的评论
Im trying to plot n [X,Y,Z] dots in 3d with their colors given by C which is a nx3 matrix describing the RGB colors for each dot (graded colors).... but its not working!!!!
scatter3(X,Y,Z,S,C, 'filled')
any suggestions?
0 个评论
采纳的回答
Geert
2013-9-5
Have a look at the example in the help:
[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 = repmat([1 2 3],numel(x),1);
scatter3(X(:),Y(:),Z(:),S(:),C(:),'filled')
4 个评论
Image Analyst
2014-7-11
Yes, any function in MATLAB that takes a 3 element numerical array for color must be in the range 0-1 instead of 0-255. If you have 255 numbers, for example determined them from some artwork in Photoshop of wherever, then you can just divide by 255
color255 = [100, 150, 240];
myColor = color255 / 255; % Then use this array in scatter() or wherever...
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!