A solid FaceColor alone isn't going to give you any feeling of the 3D shape of the spheres. If you take the edges away, you'll need to use something else to show the shape.
One option is lighting:
N = 15;
a = 1/8;
XT = randn(1,N)/6;
YT = randn(1,N)/6;
ZT = randn(1,N)/6;
for j=1:N
[x,y,z]=sphere;
hSurface=surf(a*x+XT(j),a*y+YT(j),a*z+ZT(j));
hold on
set(hSurface,'FaceColor',[0 0 1], ...
'FaceAlpha',0.5,'FaceLighting','gouraud','EdgeColor','none')
axis([-0.5 0.5 -0.5 0.5 -0.5 0.5]);
daspect([1 1 1]);
end
hold off
xlabel('X')
ylabel('Y')
zlabel('Z')
camlight
Another option would be to use FaceColor to shade them:
N = 15;
a = 1/8;
XT = randn(1,N)/6;
YT = randn(1,N)/6;
ZT = randn(1,N)/6;
[x,y,z]=sphere;
l = [.25 -.433 .5];
c = max(0,x*l(1) + y*l(2) + z*l(3));
for j=1:N
hSurface=surf(a*x+XT(j),a*y+YT(j),a*z+ZT(j),c);
hold on
set(hSurface,'FaceColor','interp','FaceAlpha',0.5,'EdgeColor','none')
axis([-0.5 0.5 -0.5 0.5 -0.5 0.5]);
daspect([1 1 1]);
end
hold off
xlabel('X')
ylabel('Y')
zlabel('Z')
colormap hot
Best Answer