Mercurial > hg > octave-nkf
diff 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 |
line wrap: on
line diff
--- a/scripts/plot/shading.m +++ b/scripts/plot/shading.m @@ -1,5 +1,4 @@ - -## Copyright (C) 2006,2007 Kai Habel +## Copyright (C) 2006, 2007 Kai Habel ## ## Octave is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by @@ -31,33 +30,38 @@ ## ## @end deftypefn -function shading(ax, mode) +## Author: Kai Habel <kai.habel@gmx.de> + +function shading (ax, mode) if (nargin == 1) mode = ax; - ax = gca(); - end - - if ((nargin !=1 ) && (nargin != 2)) - print_usage(); + ax = gca (); end - obj = findobj(ax,"Type","patch"); - obj = [obj; findobj(ax,"Type","surface")]; + if (nargin != 1 && nargin != 2) + print_usage (); + endif - for n = 1 : length(obj) + h1 = findobj (ax, "type", "patch"); + h2 = findobj (ax, "type", "surface"); + + obj = [h1, h2]; + + for n = 1:numel(obj) h = obj(n); - if strcmp(mode, "flat") - set(h,"FaceColor","flat"); - set(h,"EdgeColor","none"); - elseif strcmp(mode,"interp") - set(h,"FaceColor","interp"); - set(h,"EdgeColor","none"); - elseif strcmp(mode,"faceted") - set(h,"FaceColor","flat"); - set(h,"EdgeColor",[0 0 0]); + if (strcmp (mode, "flat")) + set (h, "facecolor", "flat"); + set (h, "edgecolor", "none"); + elseif (strcmp (mode, "interp")) + set (h, "facecolor", "interp"); + set (h, "edgecolor", "none"); + elseif (strcmp (mode, "faceted")) + set (h, "facecolor", "flat"); + set (h, "edgecolor", [0 0 0]); else - error("unknown argument") + error ("unknown argument"); endif endfor + endfunction