# HG changeset patch # User jwe # Date 1175880534 0 # Node ID e48c2a2528f6f43f9dea708bc622d07be465cd6a # Parent c7901606ba7023d8d7503c88e1d2eea9ab7be0f7 [project @ 2007-04-06 17:28:54 by jwe] diff --git a/scripts/plot/stem.m b/scripts/plot/stem.m --- a/scripts/plot/stem.m +++ b/scripts/plot/stem.m @@ -19,7 +19,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{h} =} stem (@var{x}, @var{y}, @var{linespec}) -## Plot a stem graph and return the handles of hte line and marker +## Plot a stem graph and return the handles of the line and marker ## objects used to draw the stems. The default color is @code{"r"} ## (red). The default line style is @code{"-"} and the default marker is ## @code{"o"}. @@ -80,7 +80,7 @@ ## h = stem (x, y, "fill"); ## @end example ## @noindent -## plots 10 stems with hights from 2 to 20 +## plots 10 stems with heights from 2 to 20 ## (the color is rgb-triple defined, the line style is @code{"-"}, ## the marker style is @code{"o"}, and @var{h} is a 2-by-10 array of ## handles in which the first row holds the line handles and the second @@ -104,39 +104,14 @@ newplot (); - ## first, plot the lines.. without marker - ## Use a loop and calls to line here because setting properties this - ## way doesn't work with plot yet. - idxhh = 0; - for i = 1:numel(x) - hh(++idxhh) = line ([x(i); x(i)], [0; y(i)], "color", lc, "linestyle", ls); - endfor - - ## second, plot the markers.. - hhh = []; - hhhh = []; - - ## Use a loop and calls to line here because setting properties this - ## way doesn't work with plot yet. - idxhhh = 0; - for i = 1:numel(x) - hhh(++idxhhh) = line ([x(i); x(i)], [y(i); y(i)]); - endfor - - if (find (y < 0)) - x_axis_range = get (gca, "xlim"); - hhhh = line (x_axis_range, [0, 0], "color", [0, 0, 0]); - endif - - if (dofill) - set (hhh, "markerfacecolor", mc); - endif + z = zeros (1, numel (x))); + xt = x(:)'; + yt = y(:)'; + tmp = plot ([xt; xt], [z; yt], "color", lc, "linestyle", ls, + x, y, "color", mc, "marker", ms, "linestyle", ""); if (nargout > 0) - if (! isempty (hhhh)) - hhhh = hhhh*(ones (length (hh), 1))'; - endif - h = [hh; hhh; hhhh]; + h = tmp; endif endfunction @@ -279,11 +254,11 @@ for i = 1:length(cur_props) if (isfield (cur_props(i), "markeredgecolor")) mc = cur_props(i).markeredgecolor; - elseif (isfield (cur_props(i), "color")); # means line color + elseif (isfield (cur_props(i), "color") && ! isempty (cur_props(i).color)); # means line color lc = cur_props(i).color; elseif (isfield (cur_props(i), "linestyle")) ls = cur_props(i).linestyle; - elseif (isfield (cur_props(i), "marker")) + elseif (isfield (cur_props(i), "marker") && ! strcmp (cur_props(i).marker, "none")) ms = cur_props(i).marker; endif endfor