Mercurial > hg > octave-lyh
diff scripts/plot/line.m @ 14535:8150ccfffa22
Apply broadcasting to inputs of line().
* __line__.m: Use broadcasting the match the sizes of inputs.
* line.m: Add demo.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Fri, 06 Apr 2012 19:21:16 -0400 |
parents | f3d52523cde1 |
children | f6d3d5b0bd42 |
line wrap: on
line diff
--- a/scripts/plot/line.m +++ b/scripts/plot/line.m @@ -43,6 +43,21 @@ endfunction +%!demo +%! clf +%! x = 0:0.3:10; +%! y1 = cos (x); +%! y2 = sin (x); +%! subplot (3, 1, 1) +%! args = {"color", "b", "marker", "s"}; +%! line ([x(:), x(:)], [y1(:), y2(:)], args{:}) +%! title ("Test broadcasting for line()") +%! subplot (3, 1, 2) +%! line (x(:), [y1(:), y2(:)], args{:}) +%! subplot (3, 1, 3) +%! line ([x(:), x(:)+pi/2], y1(:), args{:}) +%! xlim ([0 10]) + %!test %! hf = figure ("visible", "off"); %! unwind_protect