annotate scripts/plot/backend.m @ 10532:568c7c041fac

colorbar.m: Consistent treatment of plotboxaspectratio. Add listener for plotboxaspectratiomode.
author Ben Abbott <bpabbott@mac.com>
date Mon, 19 Apr 2010 07:22:30 -0400
parents c539ec5726e7
children 1740012184f9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9245
16f53d29049f update copyright notices
John W. Eaton <jwe@octave.org>
parents: 9143
diff changeset
1 ## Copyright (C) 2008, 2009 Michael Goffioul
8060
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
2 ##
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
3 ## This file is part of Octave.
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
4 ##
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
8 ## your option) any later version.
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
9 ##
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
13 ## General Public License for more details.
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
14 ##
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
18
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
19 ## -*- texinfo -*-
9143
74d5c1a4ca96 Eliminate 'unbalanced parentheses in @def...' error during texi2pdf.
Rik <rdrider0-list@yahoo.com>
parents: 9040
diff changeset
20 ## @deftypefn {Function File} {} backend (@var{name})
74d5c1a4ca96 Eliminate 'unbalanced parentheses in @def...' error during texi2pdf.
Rik <rdrider0-list@yahoo.com>
parents: 9040
diff changeset
21 ## @deftypefnx {Function File} {} backend (@var{hlist}, @var{name})
9040
dbd0c77e575e Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents: 8060
diff changeset
22 ## Change the default graphics backend to @var{name}. If the backend is
8060
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
23 ## not already loaded, it is first initialized (initialization is done
9316
c539ec5726e7 Update some of Advanced Plotting documentation.
Rik <rdrider0-list@yahoo.com>
parents: 9245
diff changeset
24 ## through the execution of @code{__init_@var{name}__}).
8060
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25 ##
9316
c539ec5726e7 Update some of Advanced Plotting documentation.
Rik <rdrider0-list@yahoo.com>
parents: 9245
diff changeset
26 ## When called with a list of figure handles, @var{hlist}, the backend is
c539ec5726e7 Update some of Advanced Plotting documentation.
Rik <rdrider0-list@yahoo.com>
parents: 9245
diff changeset
27 ## changed only for the listed figures.
8060
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28 ## @seealso{available_backends}
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
29 ## @end deftypefn
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
30
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
31 function backend (varargin)
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33 name = "";
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34 hlist = [];
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
36 if (nargin == 1)
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
37 if (ischar (varargin{1}))
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
38 name = varargin{1};
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
39 else
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
40 error ("backend: invalid backend name");
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
41 endif
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
42 elseif (nargin == 2)
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
43 if (isnumeric (varargin{1}) && ischar (varargin{2}))
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
44 hlist = varargin{1};
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
45 name = varargin{2};
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
46 elseif (ischar (varargin{2}))
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
47 error ("backend: invalid handle list");
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
48 else
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
49 error ("backend: invalid backend name");
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
50 endif
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
51 else
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
52 print_usage ();
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
53 endif
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
54
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
55 if (! any (strcmp (available_backends (), name)))
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
56 feval (["__init_", name, "__"]);
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
57 if (! any (strcmp (available_backends (), name)))
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
58 error ("backend: backend was not correctly registered");
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
59 endif
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
60 endif
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
61
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
62 if (isempty (hlist))
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
63 set (0, "defaultfigure__backend__", name);
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
64 else
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
65 for h = hlist(:)'
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
66 set (h, "__backend__", name);
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
67 endfor
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
68 endif
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
69
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff changeset
70 endfunction