function h = iscatter(x,y,i,c,m,msize)
%ISCATTER Scatter plot grouped by index vector.
%   ISCATTER(X,Y,I,C,M,msize) displays a scatter plot of X vs. Y grouped
%   by the index vector I.  
%
%   No error checking.  Use GSCATTER instead.
%
%   See also GSCATTER, GPLOTMATRIX.

%   Copyright 1993-2000 The MathWorks, Inc. 
%   $Revision: 1.3 $  $Date: 2000/05/26 18:52:58 $

ni = max(i);
if (isempty(ni))
   i = ones(size(x,1),1);
   ni = 1;
end
%if (nargin < 4), m = '.'; end
nm = length(m);
%if (nargin < 5), c = 'bgrcmyk'; end
nc = length(c);
%if (nargin < 6), msize = []; end
%if (isempty(msize))
%   msize = repmat(get(0,'defaultlinemarkersize'), size(m));
%end
ns = length(msize);

% Now draw the plot
hold on;
hh = [];
for j=1:ni
   ii = (i == j);
   hhh = plot(x(ii,:), y(ii,:), [c(1+mod(j-1,nc)) m(1+mod(j-1,nm))], ...
                'MarkerSize', msize(1+mod(j-1,ns)));
   hh = [hh; hhh'];
end
hold off

% Return the handles if desired.  They are arranged so that even if X
% or Y is a matrix, the first ni elements of hh(:) represent different
% groups, so they are suitable for use in drawing a legend.
if (nargout>0)
   h = hh(:);
end

