annotate scripts/plot/util/__plt_get_axis_arg__.m @ 19218:d6f1f46e5b8f stable

Fix double '-P' in print command to printer (bug #41957). * print.m: Expand documentation of latex and latexstandalone options. Change some of the documentation examples to use more useful, modern devices (jpg instead of HP DeskJet 550C). Use isempty to determine in there is a figure to print. Remove extra '-P' from print command going directly to printer.
author Michael Godfrey <michaeldgodfrey@gmail.com>
date Tue, 25 Mar 2014 17:00:41 +0000
parents d63878346099
children 446c46af4b42
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17744
d63878346099 maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents: 17720
diff changeset
1 ## Copyright (C) 1996-2013 John W. Eaton
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
2 ##
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
4 ##
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6927
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6927
diff changeset
8 ## your option) any later version.
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
9 ##
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
14 ##
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6927
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6927
diff changeset
17 ## <http://www.gnu.org/licenses/>.
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
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
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6257
diff changeset
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
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
23
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
24 ## Author: jwe
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
25
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7017
diff changeset
26 function [h, varargin, narg] = __plt_get_axis_arg__ (caller, varargin)
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7017
diff changeset
27
17036
08dd9458684a Overhaul __plt_get_axis_arg__ and newplot functions to avoid creating unnecessary axes.
Rik <rik@octave.org>
parents: 17025
diff changeset
28 h = [];
17015
761d2be77e78 __plt_get_axis_arg__.m: Simplify code for finding parent in axis PROP/VAL pairs.
Rik <rik@octave.org>
parents: 17013
diff changeset
29 parent = find (strcmpi (varargin, "parent"), 1);
17013
64d603f8bcd9 __get_axis_args.m: search for 'parent' in property/value pairs and use it as fall back axes.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14363
diff changeset
30
17125
b5d6314314fc Change various plot functions to take advantage of new isaxes() function.
Rik <rik@octave.org>
parents: 17036
diff changeset
31 ## Look for a scalar which is a graphics handle but not the
17015
761d2be77e78 __plt_get_axis_arg__.m: Simplify code for finding parent in axis PROP/VAL pairs.
Rik <rik@octave.org>
parents: 17013
diff changeset
32 ## Root Figure (0) or an ordinary figure (integer).
17125
b5d6314314fc Change various plot functions to take advantage of new isaxes() function.
Rik <rik@octave.org>
parents: 17036
diff changeset
33 if (numel (varargin) > 0 && numel (varargin{1}) == 1
b5d6314314fc Change various plot functions to take advantage of new isaxes() function.
Rik <rik@octave.org>
parents: 17036
diff changeset
34 && ishandle (varargin{1}) && varargin{1} != 0 && ! isfigure (varargin{1}))
17015
761d2be77e78 __plt_get_axis_arg__.m: Simplify code for finding parent in axis PROP/VAL pairs.
Rik <rik@octave.org>
parents: 17013
diff changeset
35 htmp = varargin{1};
17125
b5d6314314fc Change various plot functions to take advantage of new isaxes() function.
Rik <rik@octave.org>
parents: 17036
diff changeset
36 if (! isaxes (htmp))
b5d6314314fc Change various plot functions to take advantage of new isaxes() function.
Rik <rik@octave.org>
parents: 17036
diff changeset
37 error ("%s: expecting first argument to be axes handle", caller);
b5d6314314fc Change various plot functions to take advantage of new isaxes() function.
Rik <rik@octave.org>
parents: 17036
diff changeset
38 endif
b5d6314314fc Change various plot functions to take advantage of new isaxes() function.
Rik <rik@octave.org>
parents: 17036
diff changeset
39 if (! strcmp (get (htmp, "tag"), "legend"))
17025
75d115e329b7 __plt_get_axis_arg__.m: Correctly handle 'parent' property when parent is hggroup.
Rik <rik@octave.org>
parents: 17015
diff changeset
40 h = htmp;
6925
1401a79af68c [project @ 2007-09-26 18:58:52 by dbateman]
dbateman
parents: 6895
diff changeset
41 varargin(1) = [];
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
42 endif
17125
b5d6314314fc Change various plot functions to take advantage of new isaxes() function.
Rik <rik@octave.org>
parents: 17036
diff changeset
43 ## Look for "parent"/axis prop/value pair
17015
761d2be77e78 __plt_get_axis_arg__.m: Simplify code for finding parent in axis PROP/VAL pairs.
Rik <rik@octave.org>
parents: 17013
diff changeset
44 elseif (numel (varargin) > 1 && ! isempty (parent))
761d2be77e78 __plt_get_axis_arg__.m: Simplify code for finding parent in axis PROP/VAL pairs.
Rik <rik@octave.org>
parents: 17013
diff changeset
45 if (parent < numel (varargin) && ishandle (varargin{parent+1}))
761d2be77e78 __plt_get_axis_arg__.m: Simplify code for finding parent in axis PROP/VAL pairs.
Rik <rik@octave.org>
parents: 17013
diff changeset
46 htmp = varargin{parent+1};
17125
b5d6314314fc Change various plot functions to take advantage of new isaxes() function.
Rik <rik@octave.org>
parents: 17036
diff changeset
47 if (isaxes (htmp) && ! strcmp (get (htmp, "tag"), "legend"))
17025
75d115e329b7 __plt_get_axis_arg__.m: Correctly handle 'parent' property when parent is hggroup.
Rik <rik@octave.org>
parents: 17015
diff changeset
48 h = htmp;
17015
761d2be77e78 __plt_get_axis_arg__.m: Simplify code for finding parent in axis PROP/VAL pairs.
Rik <rik@octave.org>
parents: 17013
diff changeset
49 varargin(parent:parent+1) = [];
17013
64d603f8bcd9 __get_axis_args.m: search for 'parent' in property/value pairs and use it as fall back axes.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14363
diff changeset
50 else
17025
75d115e329b7 __plt_get_axis_arg__.m: Correctly handle 'parent' property when parent is hggroup.
Rik <rik@octave.org>
parents: 17015
diff changeset
51 ## 'parent' property for some other type like hggroup
17720
1ab8e21d9cfc Further corrections to parenting of axes (bug #39813)
Rik <rik@octave.org>
parents: 17719
diff changeset
52 h = [ancestor(htmp, "axes"), htmp];
17013
64d603f8bcd9 __get_axis_args.m: search for 'parent' in property/value pairs and use it as fall back axes.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14363
diff changeset
53 endif
64d603f8bcd9 __get_axis_args.m: search for 'parent' in property/value pairs and use it as fall back axes.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14363
diff changeset
54 else
64d603f8bcd9 __get_axis_args.m: search for 'parent' in property/value pairs and use it as fall back axes.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14363
diff changeset
55 error ("%s: expecting parent value to be axes handle", caller);
64d603f8bcd9 __get_axis_args.m: search for 'parent' in property/value pairs and use it as fall back axes.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14363
diff changeset
56 endif
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
57 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
58
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7017
diff changeset
59 narg = length (varargin);
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7017
diff changeset
60
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
61 endfunction
13044
a04e32272ecb codesprint: Turn off test warning for various internal helper functions
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
62
a04e32272ecb codesprint: Turn off test warning for various internal helper functions
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
63
a04e32272ecb codesprint: Turn off test warning for various internal helper functions
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
64 ## 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
65 %!assert (1)
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
66