6257
|
1 ## Copyright (C) 2005 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 2, or (at your option) |
|
8 ## 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, write to the Free |
|
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
18 ## 02110-1301, USA. |
|
19 |
|
20 ## -*- texinfo -*- |
|
21 ## @deftypefn {Function File} {} axes () |
|
22 ## @deftypefnx {Function File} {} axes (@var{property}, @var{value}, @dots{}) |
|
23 ## @deftypefnx {Function File} {} axes (@var{h}) |
|
24 ## Create an axes object and return a handle to it. |
|
25 ## @end deftypefn |
|
26 |
|
27 ## Author: jwe |
|
28 |
|
29 function h = axes (varargin) |
|
30 |
|
31 if (nargin == 0 || nargin > 1) |
|
32 ## make default axes object, and make it the current axes for the |
|
33 ## current figure. |
6851
|
34 idx = find (strcmpi (varargin(1:2:end), "parent"), 1, "first"); |
|
35 if (! isempty (idx) && length (varargin) >= 2*idx) |
|
36 cf = varargin{2*idx}; |
|
37 varargin([2*idx-1, 2*idx]) = []; |
|
38 else |
|
39 cf = gcf (); |
|
40 endif |
6405
|
41 tmp = __go_axes__ (cf, varargin{:}); |
6851
|
42 set (ancestor (cf, "figure"), "currentaxes", tmp); |
6688
|
43 else |
6257
|
44 ## arg is axes handle, make it the current axes for the current |
|
45 ## figure. |
|
46 tmp = varargin{1}; |
6405
|
47 if (ishandle (tmp) && strcmp (get (tmp, "type"), "axes")) |
6851
|
48 parent = ancestor (tmp, "figure"); |
6405
|
49 set (0, "currentfigure", parent); |
|
50 set (parent, "currentaxes", tmp); |
6257
|
51 else |
|
52 error ("axes: expecting argument to be axes handle"); |
|
53 endif |
|
54 endif |
|
55 |
|
56 if (nargout > 0) |
|
57 h = tmp; |
|
58 endif |
|
59 |
|
60 endfunction |