function hh = stem3(varargin)
%STEM3  3-D stem plot.
%   STEM3(Z) plots the discrete surface Z as stems from the xy-plane
%   terminated with circles for the data value.
%
%   STEM3(X,Y,Z) plots the surface Z at the values specified
%   in X and Y.
%
%   STEM3(...,'filled') produces a stem plot with filled markers.
%
%   STEM3(...,LINESPEC) uses the linetype specified for the stems and
%   markers.  See PLOT for possibilities.
%
%   H = STEM3(...) returns a vector of line handles.
%
%   See also STEM, QUIVER3.

%   Copyright 1984-2000 The MathWorks, Inc. 
%   $Revision: 1.16 $  $Date: 2000/06/02 04:30:54 $

nin = nargin;

fill = 0;
ls = '-';
ms = 'o';
col = '';

% Parse the string inputs
while isstr(varargin{nin}),
  v = varargin{nin};
  if ~isempty(v) & strcmp(lower(v(1)),'f')
    fill = 1;
    nin = nin-1;
  else
    [l,c,m,msg] = colstyle(v);
    if ~isempty(msg), 
      error(sprintf('Unknown option "%s".',v));
    end
    if ~isempty(l), ls = l; end
    if ~isempty(c), col = c; end
    if ~isempty(m), ms = m; end
    nin = nin-1;
  end
end

error(nargchk(1,3,nin));

[msg,x,y,z] = xyzchk(varargin{1:nin});
if ~isempty(msg), error(msg); end

if fill,
  h = quiver3(x,y,z, ...
           zeros(size(x)),zeros(size(x)),-z,0,[col,ls,ms],'filled');
else
  h = quiver3(x,y,z, ...
           zeros(size(x)),zeros(size(x)),-z,0,[col,ls,ms]);
end

if nargout>0, hh = h; end
