samer@0: function h=scatc(x,C,S,varargin) samer@0: % scatc - 2 or 3D scatter plot with colours and sizes samer@0: % samer@0: % scatc :: [[N,E]] ~'N points in E space', [[N]]~'colours' -> handle. samer@0: % scatc :: samer@0: % [[N,E]] ~'N points in E space', samer@0: % [[N]] ~'colours', samer@0: % [[N]] | real ~'array of sizes or single marker size' samer@0: % -> handle. samer@0: % samer@0: % If E<3, does 2D scatter, otherwise, does 3D scatter plot. samer@0: % Draws filled circles. samer@0: samer@0: if size(x,2)<=4 && size(x,1)>4, x=x'; end samer@0: if nargin<3 || isempty(S), samer@0: % use default marker size samer@0: S=get(gca,'DefaultLineMarkerSize').^2; samer@0: elseif length(S)==1, samer@0: S=S*ones(size(x,2),1); samer@0: end samer@0: samer@0: if size(x,1)<3, samer@0: h=scatter(x(1,:),x(2,:),S,C); samer@0: else samer@0: h=scatter3(x(1,:),x(2,:),x(3,:),S,C); samer@0: end samer@0: samer@0: set(h, ... samer@0: 'MarkerFaceColor','flat', ... samer@0: 'MarkerEdgeColor','k', ... samer@0: 'LineWidth',0.2, ... samer@0: varargin{:}); samer@0: samer@0: axis equal; samer@0: if size(x,1)>2 samer@0: axis vis3d; samer@0: axis off; samer@0: set(gca,'DrawMode','fast'); samer@0: set(gca,'Projection','perspective'); samer@0: else samer@0: box on; samer@0: % axis off; samer@0: end