changeset 8243:ec4d9d657b17

Treat line style argument in stairs
author David Bateman <dbateman@free.fr>
date Mon, 20 Oct 2008 16:02:31 +0100
parents a9d3b88ea6fb
children ca410b015910
files scripts/ChangeLog scripts/plot/fill.m scripts/plot/quiver.m scripts/plot/stairs.m
diffstat 4 files changed, 27 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Mon Oct 20 10:51:23 2008 -0400
+++ b/scripts/ChangeLog	Mon Oct 20 16:02:31 2008 +0100
@@ -1,3 +1,8 @@
+2008-10-20  David Bateman  <dbateman@free.fr>
+
+	* plot/fill.m, plot/quiver.m: Quiet the demos.
+	* plot/stair.m: Treat a line style argument correctly.
+
 2008-10-20  John W. Eaton  <jwe@octave.org>
 
 	* plot/surfnorm.m: Save and restore hold state.
--- a/scripts/plot/fill.m	Mon Oct 20 10:51:23 2008 -0400
+++ b/scripts/plot/fill.m	Mon Oct 20 16:02:31 2008 +0100
@@ -115,4 +115,4 @@
 %! y1 = cos(t1);
 %! x2 = sin(t2) + 0.8;
 %! y2 = cos(t2);
-%! h = fill(x1,y1,'r',x2,y2,'g')
+%! h = fill(x1,y1,'r',x2,y2,'g');
--- a/scripts/plot/quiver.m	Mon Oct 20 10:51:23 2008 -0400
+++ b/scripts/plot/quiver.m	Mon Oct 20 16:02:31 2008 +0100
@@ -83,7 +83,7 @@
 
 %!demo
 %! [x,y] = meshgrid(1:2:20);
-%! h = quiver(x,y,sin(2*pi*x/10),sin(2*pi*y/10))
+%! h = quiver(x,y,sin(2*pi*x/10),sin(2*pi*y/10));
 %! set (h, "maxheadsize", 0.33);
 
 %!demo
--- a/scripts/plot/stairs.m	Mon Oct 20 10:51:23 2008 -0400
+++ b/scripts/plot/stairs.m	Mon Oct 20 16:02:31 2008 +0100
@@ -137,6 +137,19 @@
   xs(ridx,:) = xtmp;
   ys(ridx,:) = y(2:nr,:);
 
+  have_line_spec = false;
+  for i = 1 : nargin - 1
+    arg = varargin {i};
+    if ((ischar (arg) || iscell (arg)) && ! have_line_spec)
+      [linespec, valid] = __pltopt__ ("stairs", arg, false);
+      if (valid)
+	have_line_spec = true;
+	varargin(i) = [];
+	break;
+      endif
+    endif
+  endfor 
+
   if (doplot)
     h = [];
     unwind_protect
@@ -152,8 +165,13 @@
 	addlistener (hg, "xdata", @update_data);
 	addlistener (hg, "ydata", @update_data);
 
-	tmp = line (xs(:,i).', ys(:,i).', "color", __next_line_color__ (),
-		    "parent", hg);
+	if (have_line_spec)
+	  tmp = line (xs(:,i).', ys(:,i).', "color", linespec.color,
+		      "parent", hg);
+	else
+	  tmp = line (xs(:,i).', ys(:,i).', "color", __next_line_color__ (),
+		      "parent", hg);
+	endif
 
         addproperty ("color", hg, "linecolor", get (tmp, "color"));
 	addproperty ("linewidth", hg, "linelinewidth", get (tmp, "linewidth"));