~ubuntu-branches/debian/sid/octave3.0/sid

« back to all changes in this revision

Viewing changes to scripts/plot/__plt_get_axis_arg__.m

  • Committer: Bazaar Package Importer
  • Author(s): Rafael Laboissiere
  • Date: 2007-12-23 16:04:15 UTC
  • Revision ID: james.westby@ubuntu.com-20071223160415-n4gk468dihy22e9v
Tags: upstream-3.0.0
ImportĀ upstreamĀ versionĀ 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
## Copyright (C) 1996, 1997, 2006, 2007 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 3 of the License, or (at
 
8
## your option) 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, see
 
17
## <http://www.gnu.org/licenses/>.
 
18
 
 
19
## Undocumented internal function.
 
20
 
 
21
## Author: jwe
 
22
 
 
23
function [h, varargin, narg] = __plt_get_axis_arg__ (caller, varargin)
 
24
 
 
25
  if (islogical (caller))
 
26
    nogca = caller;
 
27
    caller = varargin{1};
 
28
    varargin(1) = [];
 
29
  else
 
30
    nogca = false;
 
31
  endif
 
32
 
 
33
  ## Figure handles are integers, but object handles are non integer,
 
34
  ## therefore ignore integer scalars.
 
35
  if (nargin > 1 && length (varargin) > 0 && ishandle (varargin{1})
 
36
      && floor(varargin{1}) != varargin{1})
 
37
    tmp = varargin{1};
 
38
    obj = get (tmp);
 
39
    if (strcmp (obj.type, "axes") || strcmp (obj.type, "hggroup"))
 
40
      h = ancestor (tmp, "axes");
 
41
      varargin(1) = [];
 
42
      if (isempty (varargin))
 
43
        varargin = {};
 
44
      endif
 
45
    else
 
46
      error ("%s: expecting first argument to be axes handle", caller);
 
47
    endif
 
48
  else
 
49
    f = get (0, "currentfigure");
 
50
    if (isempty (f))
 
51
      h = [];
 
52
    else
 
53
      h = get (f, "currentaxes");
 
54
    endif
 
55
    if (isempty (h))
 
56
      if (nogca)
 
57
        h = NaN;
 
58
      else
 
59
        h = gca ();
 
60
      endif
 
61
    endif
 
62
    if (nargin < 2)
 
63
      varargin = {};
 
64
    endif
 
65
  endif
 
66
 
 
67
  narg = length (varargin);
 
68
 
 
69
endfunction