view private/scatc.m @ 18:062d46712995 tip

Moved mc_global_info1 back to public folder
author samer
date Mon, 02 Apr 2012 21:50:43 +0100
parents be936975f254
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 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