Mercurial > hg > octave-nkf
annotate scripts/plot/__plt_get_axis_arg__.m @ 8855:a909d8c01adf
remove duplicate conversions in OPERATORS
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 24 Feb 2009 11:12:38 +0100 |
parents | 7d48766c21a5 |
children | eb63fbe60fab |
rev | line source |
---|---|
7017 | 1 ## Copyright (C) 1996, 1997, 2006, 2007 John W. Eaton |
6257 | 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 | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
6257 | 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 | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
6257 | 18 |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8236
diff
changeset
|
19 ## -*- texinfo -*- |
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8236
diff
changeset
|
20 ## @deftypefn {Function File} {[@var{h}, @var{varargin}, @var{narg}] =} __plt_get_axis_arg__ (@var{caller}, @var{varargin}) |
6895 | 21 ## Undocumented internal function. |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8236
diff
changeset
|
22 ## @end deftypefn |
6257 | 23 |
24 ## Author: jwe | |
25 | |
7215 | 26 function [h, varargin, narg] = __plt_get_axis_arg__ (caller, varargin) |
27 | |
28 if (islogical (caller)) | |
29 nogca = caller; | |
30 caller = varargin{1}; | |
31 varargin(1) = []; | |
32 else | |
33 nogca = false; | |
34 endif | |
6257 | 35 |
7286 | 36 ## Figure handles are integers, but object handles are non integer, |
37 ## therefore ignore integer scalars. | |
8236 | 38 if (nargin > 1 && length (varargin) > 0 && isnumeric (varargin{1}) |
39 && numel (varargin{1}) == 1 && ishandle (varargin{1}(1)) | |
40 && varargin{1}(1) != 0 && ! isfigure (varargin{1}(1))) | |
6257 | 41 tmp = varargin{1}; |
6925 | 42 obj = get (tmp); |
7215 | 43 if (strcmp (obj.type, "axes") || strcmp (obj.type, "hggroup")) |
44 h = ancestor (tmp, "axes"); | |
6925 | 45 varargin(1) = []; |
46 if (isempty (varargin)) | |
47 varargin = {}; | |
6257 | 48 endif |
49 else | |
6925 | 50 error ("%s: expecting first argument to be axes handle", caller); |
6257 | 51 endif |
6925 | 52 else |
7215 | 53 f = get (0, "currentfigure"); |
7216 | 54 if (isempty (f)) |
55 h = []; | |
56 else | |
7286 | 57 h = get (f, "currentaxes"); |
7216 | 58 endif |
59 if (isempty (h)) | |
60 if (nogca) | |
61 h = NaN; | |
62 else | |
63 h = gca (); | |
64 endif | |
7215 | 65 endif |
6927 | 66 if (nargin < 2) |
67 varargin = {}; | |
68 endif | |
6257 | 69 endif |
70 | |
7215 | 71 narg = length (varargin); |
72 | |
6257 | 73 endfunction |