[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Stem update, rough guess.
From: |
Daniel J Sebald |
Subject: |
Stem update, rough guess. |
Date: |
Fri, 06 Apr 2007 00:15:18 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020 |
Attached is an update to the stem() plot. Note that one problem with
the current implementation is
stem([1:30],'o')
doesn't properly initialize options. The reason is that
__default_plot_options__ looks like the following:
function options = __default_plot_options__ ()
options.key = "";
options.color = [];
options.linestyle = "-";
options.marker = "none";
endfunction
and the color of [] fails when it is passed into plot(). I've fixed that here by only
assigning the color if it is not [] from the option settings. (Same with marker of
"none".) It may the way you had in mind John, so change if you like.
Also, I don't really follow the hh, hhh, hhhh handle stuff. My way of thinking
is that plot() should now assign that correctly if everything is done with one
plot command. So I've put comment characters in front of all those lines and
someone else can evaluate if that is really needed.
Dan
--- /usr/local/share/octave/2.9.10+/m/plot/stem.m 2007-04-05
16:23:29.000000000 -0500
+++ stem.m 2007-04-06 00:05:38.481775361 -0500
@@ -19,7 +19,7 @@
## -*- texinfo -*-
## @deftypefn {Function File} address@hidden =} 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,40 +104,29 @@
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
+ h = plot ([x(:) x(:)]', [zeros(size(x(:))) y(:)]', "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];
- endif
+# FIXME: WHAT DOES THIS DO? CHECK THIS OVER TO
+# SEE WHAT EXACTLY IT IS THAT SHOULD BE RETURNED.
+#
+# ## second, plot the markers..
+# hhhh = [];
+#
+# 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
+#
+# if (nargout > 0)
+# if (! isempty (hhhh))
+# hhhh = hhhh*(ones (length (hh), 1))';
+# endif
+# h = [hh; hhh; hhhh];
+# endif
endfunction
@@ -279,11 +268,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
- Stem update, rough guess.,
Daniel J Sebald <=
- Stem update, rough guess., John W. Eaton, 2007/04/06
- Re: Stem update, rough guess., Shai Ayal, 2007/04/06
- Re: Stem update, rough guess., Daniel J Sebald, 2007/04/06
- Re: Stem update, rough guess., John W. Eaton, 2007/04/06
- Message not available
- Re: Stem update, rough guess., John W. Eaton, 2007/04/09
- Re: Stem update, rough guess., Daniel J Sebald, 2007/04/09
- Re: Stem update, rough guess., John W. Eaton, 2007/04/09
- Re: Stem update, rough guess., Daniel J Sebald, 2007/04/09
- Re: Stem update, rough guess., John W. Eaton, 2007/04/09
- Re: Stem update, rough guess., Daniel J Sebald, 2007/04/09