Mercurial > hg > octave-lyh
diff scripts/plot/title.m @ 13800:5acb5c25e4ae
allow axes handle to be passed to title function
* __axis_label__.m: Accept axes handle argument. Don't call gca.
* xlabel.m, ylabel.m, zlabel.m: Pass axes handle to __axis_label__
instead of calling axes to temporaritly set currentaxes. Eliminate
unneeded unwind_protect block.
* title.m: Accept axes handle. Pass axes handle to __axis_label__.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 03 Nov 2011 04:41:40 -0400 |
parents | e81ddf9cacd5 |
children | d3f0d75faf2c |
line wrap: on
line diff
--- a/scripts/plot/title.m +++ b/scripts/plot/title.m @@ -19,23 +19,27 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} title (@var{string}) ## @deftypefnx {Function File} {} title (@var{string}, @var{p1}, @var{v1}, @dots{}) +## @deftypefnx {Function File} {} title (@var{h}, @dots{}) +## @deftypefnx {Function File} {@var{h} =} title (@dots{}) ## Create a title object and return a handle to it. ## @end deftypefn ## Author: jwe -function h = title (string, varargin) +function h = title (varargin) + + [h, varargin, nargin] = __plt_get_axis_arg__ ("title", varargin{:}); - if (rem (nargin, 2) == 1) - if (nargout > 0) - h = __axis_label__ ("title", string, varargin{:}); - else - __axis_label__ ("title", string, varargin{:}); - endif - else + if (rem (nargin, 2) != 1) print_usage (); endif + tmp = __axis_label__ (h, "title", varargin{:}); + + if (nargout > 0) + retval = tmp; + endif + endfunction %!demo