Mercurial > hg > octave-lyh
annotate scripts/plot/zlim.m @ 14459:a22a41ab6824
doc: Add Colin Macdonald and Mike Miller to contributors.in
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Tue, 13 Mar 2012 01:30:26 -0400 |
parents | 7277fe922e99 |
children | eaab03308c0b |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
13141
diff
changeset
|
1 ## Copyright (C) 2007-2012 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 | |
19 ## -*- texinfo -*- | |
11152
39ae406df598
Improve docstrings for functions found in undocumented list.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
20 ## @deftypefn {Function File} {@var{zl} =} zlim () |
39ae406df598
Improve docstrings for functions found in undocumented list.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
21 ## @deftypefnx {Function File} {} zlim (@var{zl}) |
14359
7277fe922e99
doc: Use Octave preference for double quote in docstrings in scripts/
Rik <octave@nomad.inbox5.com>
parents:
14245
diff
changeset
|
22 ## @deftypefnx {Function File} {@var{m} =} zlim ("mode") |
7050 | 23 ## @deftypefnx {Function File} {} zlim (@var{m}) |
24 ## @deftypefnx {Function File} {} zlim (@var{h}, @dots{}) | |
9209
923c7cb7f13f
Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents:
9040
diff
changeset
|
25 ## Get or set the limits of the z-axis of the current plot. Called without |
923c7cb7f13f
Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents:
9040
diff
changeset
|
26 ## arguments @code{zlim} returns the z-axis limits of the current plot. |
11152
39ae406df598
Improve docstrings for functions found in undocumented list.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
27 ## If passed a two element vector @var{zl}, the limits of the z-axis are set |
7050 | 28 ## to this value. |
29 ## | |
9209
923c7cb7f13f
Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents:
9040
diff
changeset
|
30 ## The current mode for calculation of the z-axis can be returned with a |
14359
7277fe922e99
doc: Use Octave preference for double quote in docstrings in scripts/
Rik <octave@nomad.inbox5.com>
parents:
14245
diff
changeset
|
31 ## call @code{zlim ("mode")}, and can be either "auto" or "manual". The |
7277fe922e99
doc: Use Octave preference for double quote in docstrings in scripts/
Rik <octave@nomad.inbox5.com>
parents:
14245
diff
changeset
|
32 ## current plotting mode can be set by passing either "auto" or "manual" |
7050 | 33 ## as the argument. |
34 ## | |
11189
a3cb42b394eb
Fix typos in docstring and demo string.
Rik <octave@nomad.inbox5.com>
parents:
11152
diff
changeset
|
35 ## If passed a handle as the first argument, then operate on this handle |
7050 | 36 ## rather than the current axes handle. |
37 ## @seealso{xlim, ylim, set, get, gca} | |
38 ## @end deftypefn | |
39 | |
40 function retval = zlim (varargin) | |
7208 | 41 ret = __axes_limits__ ("zlim", varargin{:}); |
7050 | 42 |
43 if (! isempty (ret)) | |
44 retval = ret; | |
45 endif | |
46 endfunction | |
13083
0e231bbd78bc
codesprint: demos for xlim, ylim, and zlim
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
47 |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
48 |
13083
0e231bbd78bc
codesprint: demos for xlim, ylim, and zlim
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
49 %!demo |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
50 %! clf; |
13083
0e231bbd78bc
codesprint: demos for xlim, ylim, and zlim
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
51 %! line (); |
0e231bbd78bc
codesprint: demos for xlim, ylim, and zlim
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
52 %! zlim ([0.2, 0.8]); |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
53 %! title ('zlim is [0.2, 0.8]'); |
13083
0e231bbd78bc
codesprint: demos for xlim, ylim, and zlim
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
54 %! assert (zlim (), [0.2, 0.8]); |
0e231bbd78bc
codesprint: demos for xlim, ylim, and zlim
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
55 |
0e231bbd78bc
codesprint: demos for xlim, ylim, and zlim
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
56 %!demo |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
57 %! clf; |
13083
0e231bbd78bc
codesprint: demos for xlim, ylim, and zlim
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
58 %! line (); |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
59 %! zlim ('auto'); |
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
60 %! title ('zlim is auto'); |
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
61 %! assert (zlim ('mode'), 'auto'); |
13083
0e231bbd78bc
codesprint: demos for xlim, ylim, and zlim
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
62 |
0e231bbd78bc
codesprint: demos for xlim, ylim, and zlim
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
63 %!demo |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
64 %! clf; |
13083
0e231bbd78bc
codesprint: demos for xlim, ylim, and zlim
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
65 %! plot3 ([0,1], [0,1], [0,1]); |
0e231bbd78bc
codesprint: demos for xlim, ylim, and zlim
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
66 %! zlim ([0.2, 0.8]); |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
67 %! title ('zlim is [0.2, 0.8]'); |
13083
0e231bbd78bc
codesprint: demos for xlim, ylim, and zlim
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
68 %! assert (zlim (), [0.2, 0.8]); |
0e231bbd78bc
codesprint: demos for xlim, ylim, and zlim
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
69 |
0e231bbd78bc
codesprint: demos for xlim, ylim, and zlim
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
70 %!demo |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
71 %! clf; |
13083
0e231bbd78bc
codesprint: demos for xlim, ylim, and zlim
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
72 %! plot3 ([0,1], [0,1], [0,1]); |
14245
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
73 %! zlim ('auto'); |
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
74 %! title ('zlim is auto'); |
4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
Rik <octave@nomad.inbox5.com>
parents:
14237
diff
changeset
|
75 %! assert (zlim ('mode'), 'auto'); |
13083
0e231bbd78bc
codesprint: demos for xlim, ylim, and zlim
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
76 |
13096 | 77 %!test |
13124
2ea1658ad049
Don't use explicit figure number for tests to avoid interference with any figures opened by user.
Kai Habel <kai.habel@gmx.de>
parents:
13096
diff
changeset
|
78 %! hf = figure ("visible", "off"); |
13141
e81ddf9cacd5
maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
13124
diff
changeset
|
79 %! unwind_protect |
13096 | 80 %! limz = [0, 1.1]; |
81 %! plot3 ([0,1], [0,1], [0,1]); | |
82 %! zlim (limz); | |
83 %! assert (get (gca, "zlim"), limz, eps); | |
84 %! assert (zlim ("mode"), "manual"); | |
85 %! unwind_protect_cleanup | |
86 %! close (hf); | |
87 %! end_unwind_protect | |
88 | |
89 %!test | |
13124
2ea1658ad049
Don't use explicit figure number for tests to avoid interference with any figures opened by user.
Kai Habel <kai.habel@gmx.de>
parents:
13096
diff
changeset
|
90 %! hf = figure ("visible", "off"); |
13141
e81ddf9cacd5
maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
13124
diff
changeset
|
91 %! unwind_protect |
13096 | 92 %! plot3 ([0,1], [0,1], [0, 1.1]); |
93 %! assert (get (gca, "zlim"), [0, 1.4], eps); | |
94 %! assert (zlim ("mode"), "auto"); | |
95 %! unwind_protect_cleanup | |
96 %! close (hf); | |
97 %! end_unwind_protect | |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
98 |