comparison 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
comparison
equal deleted inserted replaced
12098:51b151af0ddc 12099:b8fa8cba212f
78 endif 78 endif
79 endfunction 79 endfunction
80 80
81 function [h, xs, ys] = __stairs__ (doplot, varargin) 81 function [h, xs, ys] = __stairs__ (doplot, varargin)
82 82
83 if (nargin == 1 || ischar (varargin{2})) 83 if (nargin == 2 || ischar (varargin{2}))
84 y = varargin {1}; 84 y = varargin {1};
85 varargin(1) = []; 85 varargin(1) = [];
86 if (ismatrix (y)) 86 if (ismatrix (y))
87 if (isvector (y)) 87 if (isvector (y))
88 y = y(:); 88 y = y(:);
215 %! x = 1:10; 215 %! x = 1:10;
216 %! y = rand (1, 10); 216 %! y = rand (1, 10);
217 %! [xs, ys] = stairs (x, y); 217 %! [xs, ys] = stairs (x, y);
218 %! plot (xs, ys); 218 %! plot (xs, ys);
219 219
220 %!demo
221 %! stairs (1:9);
222
223 %!demo
224 %! [xs, ys] = stairs (9:-1:1);
225 %! plot (xs, ys);
226
220 function update_props (h, d) 227 function update_props (h, d)
221 set (get (h, "children"), "color", get (h, "color"), 228 set (get (h, "children"), "color", get (h, "color"),
222 "linewidth", get (h, "linewidth"), 229 "linewidth", get (h, "linewidth"),
223 "linestyle", get (h, "linestyle"), 230 "linestyle", get (h, "linestyle"),
224 "marker", get (h, "marker"), 231 "marker", get (h, "marker"),