]> Creatis software - CreaPhase.git/blob - octave_packages/m/plot/zlabel.m
update packages
[CreaPhase.git] / octave_packages / m / plot / zlabel.m
1 ## Copyright (C) 1995-2012 John W. Eaton
2 ##
3 ## This file is part of Octave.
4 ##
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.
9 ##
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.
14 ##
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/>.
18
19 ## -*- texinfo -*-
20 ## @deftypefn  {Function File} {} zlabel (@var{string})
21 ## @deftypefnx {Function File} {} zlabel (@var{h}, @var{string})
22 ## @deftypefnx {Function File} {@var{h} =} zlabel (@dots{})
23 ## @seealso{xlabel}
24 ## @end deftypefn
25
26 ## Author: jwe
27
28 function retval = zlabel (varargin)
29
30   [h, varargin, nargin] = __plt_get_axis_arg__ ("zlabel", varargin{:});
31
32   if (rem (nargin, 2) != 1)
33     print_usage ();
34   endif
35
36   tmp = __axis_label__ (h, "zlabel", varargin{:},
37                         "color", get (h, "zcolor"));
38
39   if (nargout > 0)
40     retval = tmp;
41   endif
42
43 endfunction
44
45
46 %!test
47 %! hf = figure ("visible", "off");
48 %! unwind_protect
49 %!   z = zlabel ("zlabel_string");
50 %!   assert (get (gca, "zlabel"), z);
51 %!   assert (get (z, "type"), "text");
52 %!   assert (get (z, "visible"), "off");
53 %!   assert (get (z, "string"), "zlabel_string");
54 %! unwind_protect_cleanup
55 %!   close (hf);
56 %! end_unwind_protect
57
58 %!test
59 %! hf = figure ("visible", "off");
60 %! plot3 (0, 0, 0);
61 %! unwind_protect
62 %!   z = zlabel ("zlabel_string");
63 %!   assert (get (gca, "zlabel"), z);
64 %!   assert (get (z, "type"), "text");
65 %!   assert (get (z, "visible"), "off");
66 %!   assert (get (z, "string"), "zlabel_string");
67 %! unwind_protect_cleanup
68 %!   close (hf);
69 %! end_unwind_protect
70