Mercurial > hg > octave-nkf
comparison scripts/plot/shading.m @ 7110:0e63f1126f01
[project @ 2007-11-06 22:36:22 by jwe]
author | jwe |
---|---|
date | Tue, 06 Nov 2007 22:36:22 +0000 |
parents | 5436efbf35e3 |
children | 542379d37bf9 |
comparison
equal
deleted
inserted
replaced
7109:5436efbf35e3 | 7110:0e63f1126f01 |
---|---|
1 | 1 ## Copyright (C) 2006, 2007 Kai Habel |
2 ## Copyright (C) 2006,2007 Kai Habel | |
3 ## | 2 ## |
4 ## Octave is free software; you can redistribute it and/or modify it | 3 ## Octave is free software; you can redistribute it and/or modify it |
5 ## under the terms of the GNU General Public License as published by | 4 ## under the terms of the GNU General Public License as published by |
6 ## the Free Software Foundation; either version 2, or (at your option) | 5 ## the Free Software Foundation; either version 2, or (at your option) |
7 ## any later version. | 6 ## any later version. |
29 ## shading ("interp") | 28 ## shading ("interp") |
30 ## @end example | 29 ## @end example |
31 ## | 30 ## |
32 ## @end deftypefn | 31 ## @end deftypefn |
33 | 32 |
34 function shading(ax, mode) | 33 ## Author: Kai Habel <kai.habel@gmx.de> |
34 | |
35 function shading (ax, mode) | |
35 | 36 |
36 if (nargin == 1) | 37 if (nargin == 1) |
37 mode = ax; | 38 mode = ax; |
38 ax = gca(); | 39 ax = gca (); |
39 end | 40 end |
40 | 41 |
41 if ((nargin !=1 ) && (nargin != 2)) | 42 if (nargin != 1 && nargin != 2) |
42 print_usage(); | 43 print_usage (); |
43 end | 44 endif |
44 | 45 |
45 obj = findobj(ax,"Type","patch"); | 46 h1 = findobj (ax, "type", "patch"); |
46 obj = [obj; findobj(ax,"Type","surface")]; | 47 h2 = findobj (ax, "type", "surface"); |
47 | 48 |
48 for n = 1 : length(obj) | 49 obj = [h1, h2]; |
50 | |
51 for n = 1:numel(obj) | |
49 h = obj(n); | 52 h = obj(n); |
50 if strcmp(mode, "flat") | 53 if (strcmp (mode, "flat")) |
51 set(h,"FaceColor","flat"); | 54 set (h, "facecolor", "flat"); |
52 set(h,"EdgeColor","none"); | 55 set (h, "edgecolor", "none"); |
53 elseif strcmp(mode,"interp") | 56 elseif (strcmp (mode, "interp")) |
54 set(h,"FaceColor","interp"); | 57 set (h, "facecolor", "interp"); |
55 set(h,"EdgeColor","none"); | 58 set (h, "edgecolor", "none"); |
56 elseif strcmp(mode,"faceted") | 59 elseif (strcmp (mode, "faceted")) |
57 set(h,"FaceColor","flat"); | 60 set (h, "facecolor", "flat"); |
58 set(h,"EdgeColor",[0 0 0]); | 61 set (h, "edgecolor", [0 0 0]); |
59 else | 62 else |
60 error("unknown argument") | 63 error ("unknown argument"); |
61 endif | 64 endif |
62 endfor | 65 endfor |
66 | |
63 endfunction | 67 endfunction |