www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/VaryMarkerColorExample.m
%% Vary Marker Color % Copyright 2015 The MathWorks, Inc. %% % Use |sphere| to define vectors |x|, |y|, and |z|. [X,Y,Z] = sphere(16); x = [0.5*X(:); 0.75*X(:); X(:)]; y = [0.5*Y(:); 0.75*Y(:); Y(:)]; z = [0.5*Z(:); 0.75*Z(:); Z(:)]; %% % Define vectors |s| and |c| to specify the size and color of each marker. S = repmat([50,25,10],numel(X),1); C = repmat([1,2,3],numel(X),1); s = S(:); c = C(:); %% % Create a 3-D scatter plot and use |view| to change the angle of the axes % in the figure. figure scatter3(x,y,z,s,c) view(40,35) %% % Corresponding entries in |x|, |y|, |z|, and |c| determine the location % and color of each marker.