diff scripts/plot/stairs.m @ 12099:b8fa8cba212f release-3-2-x

stairs.m (__stairs__): correct nargin check; new demos
author John W. Eaton <jwe@octave.org>
date Fri, 20 Nov 2009 10:49:17 +0100
parents eb63fbe60fab
children 95c3e38098bf
line wrap: on
line diff
--- a/scripts/plot/stairs.m	Fri Nov 20 10:48:23 2009 +0100
+++ b/scripts/plot/stairs.m	Fri Nov 20 10:49:17 2009 +0100
@@ -80,7 +80,7 @@
 
 function [h, xs, ys] = __stairs__ (doplot, varargin)
 
-  if (nargin == 1 || ischar (varargin{2}))
+  if (nargin == 2 || ischar (varargin{2}))
     y = varargin {1};
     varargin(1) = [];
     if (ismatrix (y))
@@ -217,6 +217,13 @@
 %! [xs, ys] = stairs (x, y);
 %! plot (xs, ys);
 
+%!demo
+%! stairs (1:9);
+
+%!demo
+%! [xs, ys] = stairs (9:-1:1);
+%! plot (xs, ys);
+
 function update_props (h, d)
   set (get (h, "children"), "color", get (h, "color"), 
        "linewidth", get (h, "linewidth"),