www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/VaryMarkerSizeExample.m

    %% Vary Marker Size  

% 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 vector |s| to specify the marker sizes.  
S = repmat([100,50,5],numel(X),1);
s = S(:);  

%% 
% 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)
view(40,35)    

%%
% Corresponding entries in |x|, |y|, |z|, and |s| determine the location
% and size of each marker.