Mercurial > hg > ishara
view graphics/scatc.m @ 61:eff6bddf82e3 tip
Finally implemented perceptual brightness thing.
author | samer |
---|---|
date | Sun, 11 Oct 2015 10:20:42 +0100 |
parents | ba866ae124c6 |
children |
line wrap: on
line source
function h=scatc(x,C,S,varargin) % scatc - 2 or 3D scatter plot with colours and sizes % % scatc :: [[N,E]] ~'N points in E space', [[N]]~'colours' -> handle. % scatc :: % [[N,E]] ~'N points in E space', % [[N]] ~'colours', % [[N]] | real ~'array of sizes or single marker size' % -> handle. % % If E<3, does 2D scatter, otherwise, does 3D scatter plot. % Draws filled circles. if size(x,2)<=4 && size(x,1)>4, x=x'; end if nargin<3 || isempty(S), % use default marker size S=get(gca,'DefaultLineMarkerSize').^2; elseif length(S)==1, S=S*ones(size(x,2),1); end if isscalar(C), C=repmat(C,1,size(x,2)); end if size(x,1)<3, h=scatter(x(1,:),x(2,:),S,C); else h=scatter3(x(1,:),x(2,:),x(3,:),S,C); end set(h, ... 'MarkerFaceColor','flat', ... 'MarkerEdgeColor','k', ... 'LineWidth',0.2, ... varargin{:}); axis equal; if size(x,1)>2 axis vis3d; axis off; set(gca,'DrawMode','fast'); set(gca,'Projection','perspective'); else box on; % axis off; end