function coolstem(x,y,c)

%COOLSTEM(X,Y) plots a stem plot of Y versus X using bar and plot with
%   the 'o' marker in a size that's reasonable for our subplots.  The
%   default color is black.
%   COOLSTEM(X,Y,C) draws the same plot in the specified color C.
%
%   D. Tran 11-3-99
%

if (nargin==2)
   c = 'b';
end

% plot with face color c and scale=0.01 (only edges are visible)
h = bar(x,y,0.01,c);   
% set edges to the desired color
set(h,'EdgeColor',c);
% turn hold on for the duration of this function
hold on;         
len = length(x);
if (len<=8)
   msize = 64/length(x); % the longer x, the smaller the marker
elseif (len<=16)
   msize = 128/length(x);
elseif (len<=32)
   msize = 200/length(x);
elseif (len<=64)
   msize = 256/length(x);
else
   msize = 512/length(x);   
end
plot(x,y,[c 'o'],'MarkerEdgeColor',c,'MarkerSize',msize);
hold off;

