1 ## Copyright (C) 2006-2012 Kai Habel
3 ## This file is part of Octave.
5 ## Octave is free software; you can redistribute it and/or modify it
6 ## under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 3 of the License, or (at
8 ## your option) any later version.
10 ## Octave is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ## General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with Octave; see the file COPYING. If not, see
17 ## <http://www.gnu.org/licenses/>.
20 ## @deftypefn {Function File} {} shading (@var{type})
21 ## @deftypefnx {Function File} {} shading (@var{ax}, @dots{})
22 ## Set the shading of surface or patch graphic objects. Valid arguments
27 ## Single colored patches with invisible edges.
30 ## Single colored patches with visible edges.
33 ## Color between patch vertices are interpolated and the patch edges are
37 ## If @var{ax} is given the shading is applied to axis @var{ax} instead
38 ## of the current axis.
41 ## Author: Kai Habel <kai.habel@gmx.de>
43 function shading (varargin)
45 [ax, varargin] = __plt_get_axis_arg__ ("shading", varargin{:});
47 if (nargin != 1 && nargin != 2)
53 h1 = findobj (ax, "type", "patch");
54 h2 = findobj (ax, "type", "surface");
60 if (strcmpi (mode, "flat"))
61 set (h, "facecolor", "flat");
62 set (h, "edgecolor", "none");
63 elseif (strcmpi (mode, "interp"))
64 set (h, "facecolor", "interp");
65 set (h, "edgecolor", "none");
66 elseif (strcmpi (mode, "faceted"))
67 set (h, "facecolor", "flat");
68 set (h, "edgecolor", [0 0 0]);
70 error ("shading: unknown argument");
82 %! title ('shading "faceted"')
88 %! title ('shading "flat"')
94 %! title ('shading "interp"')
100 %! title ('shading "faceted"')
106 %! title ('shading "flat"')
112 %! title ('shading "interp"')