Mercurial > octave-antonio
annotate scripts/plot/appearance/private/__axis_limits__.m @ 19833:9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Try to trim long lines to < 80 chars.
Use '##' for single line comments.
Use '(...)' around tests for if/elseif/switch/while.
Abut cell indexing operator '{' next to variable.
Abut array indexing operator '(' next to variable.
Use space between negation operator '!' and following expression.
Use two newlines between endfunction and start of %!test or %!demo code.
Remove unnecessary parens grouping between short-circuit operators.
Remove stray extra spaces (typos) between variables and assignment operators.
Remove stray extra spaces from ends of lines.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 23 Feb 2015 14:54:39 -0800 |
parents | 4197fc428c7d |
children |
rev | line source |
---|---|
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
18588
diff
changeset
|
1 ## Copyright (C) 2007-2015 David Bateman |
7050 | 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 | |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8190
diff
changeset
|
19 ## -*- texinfo -*- |
17574
662db69503b4
__axis_limits__.m: Change function prototype to match file name.
Rik <rik@octave.org>
parents:
17572
diff
changeset
|
20 ## @deftypefn {Function File} {} __axis_limits__ (@var{fcn}, @dots{}) |
7050 | 21 ## Undocumented internal function. |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8190
diff
changeset
|
22 ## @end deftypefn |
7050 | 23 |
17574
662db69503b4
__axis_limits__.m: Change function prototype to match file name.
Rik <rik@octave.org>
parents:
17572
diff
changeset
|
24 function retval = __axis_limits__ (fcn, varargin) |
7216 | 25 |
17044
cec8c423b3e8
__axes_limits__.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
26 [hax, varargin, nargin] = __plt_get_axis_arg__ (fcn, varargin{:}); |
cec8c423b3e8
__axes_limits__.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
27 |
cec8c423b3e8
__axes_limits__.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
28 if (isempty (hax)) |
cec8c423b3e8
__axes_limits__.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
29 hax = gca (); |
cec8c423b3e8
__axes_limits__.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
30 endif |
7050 | 31 |
7215 | 32 if (nargin == 0) |
17044
cec8c423b3e8
__axes_limits__.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
33 retval = get (hax, fcn); |
7050 | 34 else |
17156
1748182db458
__axes_limits__.m: Update code to modern conventions.
Rik <rik@octave.org>
parents:
17044
diff
changeset
|
35 retval = []; |
1748182db458
__axes_limits__.m: Update code to modern conventions.
Rik <rik@octave.org>
parents:
17044
diff
changeset
|
36 fcnmode = [fcn "mode"]; |
7215 | 37 arg = varargin{1}; |
7050 | 38 if (ischar (arg)) |
8190
73d6b71788c0
use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents:
7216
diff
changeset
|
39 if (strcmpi (arg, "mode")) |
17044
cec8c423b3e8
__axes_limits__.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
40 retval = get (hax, fcnmode); |
17156
1748182db458
__axes_limits__.m: Update code to modern conventions.
Rik <rik@octave.org>
parents:
17044
diff
changeset
|
41 elseif (any (strcmpi (arg, {"auto", "manual"}))) |
17044
cec8c423b3e8
__axes_limits__.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
42 set (hax, fcnmode, arg); |
7050 | 43 endif |
44 else | |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
45 if (! isnumeric (arg) && any (size (arg(:)) != [2, 1])) |
17156
1748182db458
__axes_limits__.m: Update code to modern conventions.
Rik <rik@octave.org>
parents:
17044
diff
changeset
|
46 error ("%s: LIMITS must be a 2-element vector", fcn); |
7050 | 47 else |
13037
f7af3834405c
plot/private/__axis_limits__.m: Check lower axis limit come first.
Matthias Jüschke <matthias.jueschke@gmx.net>
parents:
11523
diff
changeset
|
48 if (arg(1) >= arg(2)) |
13744 | 49 error ("%s: axis limits must be increasing", fcn); |
13037
f7af3834405c
plot/private/__axis_limits__.m: Check lower axis limit come first.
Matthias Jüschke <matthias.jueschke@gmx.net>
parents:
11523
diff
changeset
|
50 else |
18588
5032ac119d52
Make xlim, ylim and zlim accept special values Inf/-Inf (bug #41933).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
51 autoscale = isinf (arg); |
5032ac119d52
Make xlim, ylim and zlim accept special values Inf/-Inf (bug #41933).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
52 if (any (autoscale)) |
5032ac119d52
Make xlim, ylim and zlim accept special values Inf/-Inf (bug #41933).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
53 set (hax, fcnmode, "auto"); |
5032ac119d52
Make xlim, ylim and zlim accept special values Inf/-Inf (bug #41933).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
54 arg(autoscale) = get (hax, fcn)(autoscale); |
5032ac119d52
Make xlim, ylim and zlim accept special values Inf/-Inf (bug #41933).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17744
diff
changeset
|
55 endif |
17044
cec8c423b3e8
__axes_limits__.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
56 set (hax, fcn, arg(:)); |
13037
f7af3834405c
plot/private/__axis_limits__.m: Check lower axis limit come first.
Matthias Jüschke <matthias.jueschke@gmx.net>
parents:
11523
diff
changeset
|
57 endif |
7050 | 58 endif |
59 endif | |
60 endif | |
7216 | 61 |
7050 | 62 endfunction |
17156
1748182db458
__axes_limits__.m: Update code to modern conventions.
Rik <rik@octave.org>
parents:
17044
diff
changeset
|
63 |