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. |
|
34 cf = gcf (); |
|
35 tmp = __uiobject_axes_ctor__ (cf, varargin{:}); |
|
36 __uiobject_adopt__ (cf, tmp); |
|
37 set (cf, "currentaxes", tmp); |
|
38 elseif (nargin == 1) |
|
39 ## arg is axes handle, make it the current axes for the current |
|
40 ## figure. |
|
41 tmp = varargin{1}; |
|
42 obj = get (tmp); |
|
43 if (! isempty (obj) && strcmp (obj.type, "axes")) |
|
44 cf = gcf (); |
|
45 __uiobject_adopt__ (cf, tmp); |
|
46 set (cf, "currentaxes", tmp); |
|
47 else |
|
48 error ("axes: expecting argument to be axes handle"); |
|
49 endif |
|
50 else |
|
51 print_usage (); |
|
52 endif |
|
53 |
|
54 if (nargout > 0) |
|
55 h = tmp; |
|
56 endif |
|
57 |
|
58 endfunction |