comparison scripts/plot/xlabel.m @ 7194:a927a2871a93

[project @ 2007-11-26 23:06:12 by jwe]
author jwe
date Mon, 26 Nov 2007 23:06:13 +0000
parents a1dbe9d80eee
children a730e47fda4d
comparison
equal deleted inserted replaced
7193:cbdee3da62bd 7194:a927a2871a93
19 19
20 ## -*- texinfo -*- 20 ## -*- texinfo -*-
21 ## @deftypefn {Function File} {} xlabel (@var{string}) 21 ## @deftypefn {Function File} {} xlabel (@var{string})
22 ## @deftypefnx {Function File} {} ylabel (@var{string}) 22 ## @deftypefnx {Function File} {} ylabel (@var{string})
23 ## @deftypefnx {Function File} {} zlabel (@var{string}) 23 ## @deftypefnx {Function File} {} zlabel (@var{string})
24 ## Specify x, y, and z axis labels for the current figure. 24 ## @deftypefnx {Function File} {} xlabel (@var{h}, @var{string})
25 ## Specify x, y, and z axis labels for the current figure. If @var{h} is
26 ## specified then label the axis defined by @var{h}.
25 ## @seealso{plot, semilogx, semilogy, loglog, polar, mesh, contour, 27 ## @seealso{plot, semilogx, semilogy, loglog, polar, mesh, contour,
26 ## bar, stairs, ylabel, title} 28 ## bar, stairs, ylabel, title}
27 ## @end deftypefn 29 ## @end deftypefn
28 30
29 ## Author: jwe 31 ## Author: jwe
30 32
31 function h = xlabel (varargin) 33 function h = xlabel (varargin)
32 34
33 if (rem (nargin, 2) == 1) 35 if (isscalar (varargin{1}) && ishandle (varargin{1}))
34 if (nargout > 0) 36 ax = varargin {1};
35 h = __axis_label__ ("xlabel", varargin{:}); 37 if (! strcmp (get (ax, "type"), "axes"))
36 else 38 error ("xlabel: expecting first argument to be an axes object");
37 __axis_label__ ("xlabel", varargin{:});
38 endif 39 endif
40 if (rem (nargin, 2) == 1)
41 print_usage ();
42 endif
43 oldh = gca ();
44 unwind_protect
45 axes (ax);
46 tmp = __axis_label__ ("xlabel", varargin{2:end});
47 unwind_protect_cleanup
48 axes (oldh);
49 end_unwind_protect
39 else 50 else
40 print_usage (); 51 if (rem (nargin, 2) != 1)
52 print_usage ();
53 endif
54 tmp = __axis_label__ ("xlabel", varargin{1:end});
55 endif
56
57 if (nargout > 0)
58 h = tmp;
41 endif 59 endif
42 60
43 endfunction 61 endfunction