Mercurial > hg > octave-lyh
annotate scripts/plot/__plt_get_axis_arg__.m @ 13115:cd808de114c1
Allow surface and patch to be called w/o arguments. Adding and fixing tests.
plot/line.m: Style fixes and test added.
plot/patch.m: Tests added.
plot/surface.m: Allow surface to be called w/o arguments. Tests added.
plot/private/__patch__.m: Allow patch to be called w/o arguments.
author | Kai Habel <kai.habel@gmx.de> |
---|---|
date | Thu, 08 Sep 2011 15:43:40 +0200 |
parents | a04e32272ecb |
children | 9cae456085c2 |
rev | line source |
---|---|
11523 | 1 ## Copyright (C) 1996-2011 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. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
38 if (nargin > 1 && length (varargin) > 0 && isnumeric (varargin{1}) |
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
39 && numel (varargin{1}) == 1 && ishandle (varargin{1}(1)) |
8236 | 40 && varargin{1}(1) != 0 && ! isfigure (varargin{1}(1))) |
6257 | 41 tmp = varargin{1}; |
6925 | 42 obj = get (tmp); |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
43 if ((strcmp (obj.type, "axes") && ! strcmp (obj.tag, "legend")) |
10995
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10990
diff
changeset
|
44 || strcmp (obj.type, "hggroup")) |
7215 | 45 h = ancestor (tmp, "axes"); |
6925 | 46 varargin(1) = []; |
47 if (isempty (varargin)) | |
10549 | 48 varargin = {}; |
6257 | 49 endif |
50 else | |
6925 | 51 error ("%s: expecting first argument to be axes handle", caller); |
6257 | 52 endif |
6925 | 53 else |
7215 | 54 f = get (0, "currentfigure"); |
7216 | 55 if (isempty (f)) |
56 h = []; | |
57 else | |
7286 | 58 h = get (f, "currentaxes"); |
7216 | 59 endif |
60 if (isempty (h)) | |
61 if (nogca) | |
10549 | 62 h = NaN; |
7216 | 63 else |
10549 | 64 h = gca (); |
7216 | 65 endif |
7215 | 66 endif |
6927 | 67 if (nargin < 2) |
68 varargin = {}; | |
69 endif | |
6257 | 70 endif |
71 | |
10510
62ebba45054e
Respect the nextplot property value of 'new' for axes and 'replacechildren' for axes and figures.
Ben Abbott <bpabbott@mac.com>
parents:
8920
diff
changeset
|
72 if (ishandle (h) && strcmp (get (h, "nextplot"), "new")) |
62ebba45054e
Respect the nextplot property value of 'new' for axes and 'replacechildren' for axes and figures.
Ben Abbott <bpabbott@mac.com>
parents:
8920
diff
changeset
|
73 h = axes (); |
62ebba45054e
Respect the nextplot property value of 'new' for axes and 'replacechildren' for axes and figures.
Ben Abbott <bpabbott@mac.com>
parents:
8920
diff
changeset
|
74 endif |
62ebba45054e
Respect the nextplot property value of 'new' for axes and 'replacechildren' for axes and figures.
Ben Abbott <bpabbott@mac.com>
parents:
8920
diff
changeset
|
75 |
7215 | 76 narg = length (varargin); |
77 | |
6257 | 78 endfunction |
13044
a04e32272ecb
codesprint: Turn off test warning for various internal helper functions
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
79 |
a04e32272ecb
codesprint: Turn off test warning for various internal helper functions
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
80 |
a04e32272ecb
codesprint: Turn off test warning for various internal helper functions
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
81 ## No test needed for internal helper function. |
a04e32272ecb
codesprint: Turn off test warning for various internal helper functions
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
82 %!assert (1) |