Mercurial > octave-nkf
comparison scripts/plot/contour.m @ 6434:7caa5942d4da
[project @ 2007-03-23 13:59:29 by jwe]
author | jwe |
---|---|
date | Fri, 23 Mar 2007 13:59:29 +0000 |
parents | 195382e92d51 |
children | 98ee80702bca |
comparison
equal
deleted
inserted
replaced
6433:71c052b5ce47 | 6434:7caa5942d4da |
---|---|
42 ## @var{c}=contourc (@var{x}, @var{y}, @var{z}, linspace(0,2*pi,10)) | 42 ## @var{c}=contourc (@var{x}, @var{y}, @var{z}, linspace(0,2*pi,10)) |
43 ## @end example | 43 ## @end example |
44 ## @seealso{contourc,line,plot} | 44 ## @seealso{contourc,line,plot} |
45 ## @end deftypefn | 45 ## @end deftypefn |
46 | 46 |
47 | |
48 ## Author: shaia | 47 ## Author: shaia |
49 | 48 |
50 function retval = contour (varargin) | 49 function retval = contour (varargin) |
51 | 50 |
52 [c, lev] = contourc (varargin{:}); | 51 [c, lev] = contourc (varargin{:}); |
55 | 54 |
56 levx = linspace (min (lev), max (lev), size (cmap, 1)); | 55 levx = linspace (min (lev), max (lev), size (cmap, 1)); |
57 | 56 |
58 newplot (); | 57 newplot (); |
59 | 58 |
60 ## decode contourc output format | 59 ## Decode contourc output format. |
61 i1 = 1; | 60 i1 = 1; |
62 while (i1 < length (c)) | 61 while (i1 < length (c)) |
62 | |
63 clev = c(1,i1); | 63 clev = c(1,i1); |
64 clen = c(2,i1); | 64 clen = c(2,i1); |
65 | 65 |
66 ccr = interp1 (levx, cmap(:,1), clev); | 66 ccr = interp1 (levx, cmap(:,1), clev); |
67 ccg = interp1 (levx, cmap(:,2), clev); | 67 ccg = interp1 (levx, cmap(:,2), clev); |
71 line (c(1,ii), c(2,ii), "color", [ccr, ccg, ccb]); | 71 line (c(1,ii), c(2,ii), "color", [ccr, ccg, ccb]); |
72 | 72 |
73 i1 += c(2,i1)+1; | 73 i1 += c(2,i1)+1; |
74 endwhile | 74 endwhile |
75 | 75 |
76 drawnow (); | |
77 | |
78 ## folowing DM's suggestion to surpress output if none asked for | |
79 if (nargout > 0) | 76 if (nargout > 0) |
80 retval = c; | 77 retval = c; |
81 endif | 78 endif |
82 | 79 |
83 endfunction | 80 endfunction |