]> Creatis software - CreaPhase.git/blob - octave_packages/m/plot/xlabel.m
update packages
[CreaPhase.git] / octave_packages / m / plot / xlabel.m
1 ## Copyright (C) 1993-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} {} xlabel (@var{string})
21 ## @deftypefnx {Function File} {} xlabel (@var{h}, @var{string})
22 ## @deftypefnx {Function File} {@var{h} =} xlabel (@dots{})
23 ## @deftypefnx {Function File} {} ylabel (@dots{})
24 ## @deftypefnx {Function File} {} zlabel (@dots{})
25 ## Specify x-, y-, or z-axis labels for the current axis.  If @var{h} is
26 ## specified then label the axis defined by @var{h}.
27 ##
28 ## The optional return value @var{h} is a graphics handle to the created object.
29 ## @seealso{title, text}
30 ## @end deftypefn
31
32 ## Author: jwe
33
34 function retval = xlabel (varargin)
35
36   [h, varargin, nargin] = __plt_get_axis_arg__ ("xlabel", varargin{:});
37
38   if (rem (nargin, 2) != 1)
39     print_usage ();
40   endif
41
42   tmp = __axis_label__ (h, "xlabel", varargin{:},
43                         "color", get (h, "xcolor"));
44
45   if (nargout > 0)
46     retval = tmp;
47   endif
48
49 endfunction
50
51
52 %!test
53 %! hf = figure ("visible", "off");
54 %! unwind_protect
55 %!   x = xlabel ("xlabel_string");
56 %!   assert (get (gca, "xlabel"), x);
57 %!   assert (get (x, "type"), "text");
58 %!   assert (get (x, "visible"), "on");
59 %!   assert (get (x, "string"), "xlabel_string");
60 %! unwind_protect_cleanup
61 %!   close (hf);
62 %! end_unwind_protect
63