Mercurial > octave
annotate scripts/plot/appearance/box.m @ 25054:6652d3823428 stable
maint: Update copyright dates in all source files.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 30 Mar 2018 09:19:05 -0400 |
parents | 194eb4bd202b |
children | 00f796120a6d |
rev | line source |
---|---|
25054
6652d3823428
maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1 ## Copyright (C) 2006-2018 John W. Eaton |
6052 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24432
diff
changeset
|
5 ## Octave is free software: you can redistribute it and/or modify it |
6052 | 6 ## under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24432
diff
changeset
|
7 ## the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22363
diff
changeset
|
8 ## (at your option) any later version. |
6052 | 9 ## |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22363
diff
changeset
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22363
diff
changeset
|
13 ## GNU General Public License for more details. |
6052 | 14 ## |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24432
diff
changeset
|
17 ## <https://www.gnu.org/licenses/>. |
6052 | 18 |
19 ## -*- texinfo -*- | |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20178
diff
changeset
|
20 ## @deftypefn {} {} box |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20178
diff
changeset
|
21 ## @deftypefnx {} {} box on |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20178
diff
changeset
|
22 ## @deftypefnx {} {} box off |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20178
diff
changeset
|
23 ## @deftypefnx {} {} box (@var{hax}, @dots{}) |
24431
0c6cedafc71e
doc: Use 'axes' rather than 'axis' appropriately in docstrings.
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
24 ## Control display of the axes border. |
17049
0322e057697f
hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
14385
diff
changeset
|
25 ## |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17122
diff
changeset
|
26 ## The argument may be either @qcode{"on"} or @qcode{"off"}. If it is |
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17122
diff
changeset
|
27 ## omitted, the current box state is toggled. |
14385
310039bc3dd3
box.m: Allow specification of a graphics axis to act on (bug #35486).
Garrett G Euler <ggeuler@gmail.com>
parents:
14138
diff
changeset
|
28 ## |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
29 ## If the first argument @var{hax} is an axes handle, then operate on this |
24431
0c6cedafc71e
doc: Use 'axes' rather than 'axis' appropriately in docstrings.
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
30 ## axes rather than the current axes returned by @code{gca}. |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17049
diff
changeset
|
31 ## @seealso{axis, grid} |
6052 | 32 ## @end deftypefn |
33 | |
34 ## Author: jwe | |
35 | |
6257 | 36 function box (varargin) |
37 | |
17049
0322e057697f
hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
14385
diff
changeset
|
38 [hax, varargin, nargs] = __plt_get_axis_arg__ ("box", varargin{:}); |
6257 | 39 |
17049
0322e057697f
hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
14385
diff
changeset
|
40 if (isempty (hax)) |
0322e057697f
hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
14385
diff
changeset
|
41 hax = gca (); |
0322e057697f
hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
14385
diff
changeset
|
42 endif |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
43 |
6257 | 44 if (nargs == 0) |
17049
0322e057697f
hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
14385
diff
changeset
|
45 box_state = get (hax, "box"); |
14385
310039bc3dd3
box.m: Allow specification of a graphics axis to act on (bug #35486).
Garrett G Euler <ggeuler@gmail.com>
parents:
14138
diff
changeset
|
46 if (strcmp (box_state, "on")) |
6257 | 47 box_state = "off"; |
48 else | |
49 box_state = "on"; | |
50 endif | |
51 elseif (nargs == 1) | |
52 state = varargin{1}; | |
53 if (ischar (state)) | |
8190
73d6b71788c0
use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
54 if (strcmpi (state, "off")) |
10549 | 55 box_state = "off"; |
8190
73d6b71788c0
use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
56 elseif (strcmpi (state, "on")) |
10549 | 57 box_state = "on"; |
6257 | 58 else |
14385
310039bc3dd3
box.m: Allow specification of a graphics axis to act on (bug #35486).
Garrett G Euler <ggeuler@gmail.com>
parents:
14138
diff
changeset
|
59 error ('box: argument must be "on" or "off"'); |
6257 | 60 endif |
14385
310039bc3dd3
box.m: Allow specification of a graphics axis to act on (bug #35486).
Garrett G Euler <ggeuler@gmail.com>
parents:
14138
diff
changeset
|
61 else |
310039bc3dd3
box.m: Allow specification of a graphics axis to act on (bug #35486).
Garrett G Euler <ggeuler@gmail.com>
parents:
14138
diff
changeset
|
62 error ('box: argument must be "on" or "off"'); |
6257 | 63 endif |
64 else | |
65 print_usage (); | |
66 endif | |
67 | |
17049
0322e057697f
hold.m, grid.m, box.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
14385
diff
changeset
|
68 set (hax, "box", box_state); |
6052 | 69 |
70 endfunction | |
17338
1c89599167a6
maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
71 |
22363
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
72 |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
73 %!demo |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
74 %! clf; |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
75 %! plot (1:10, "o-"); |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
76 %! box off; |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
77 %! title ("box off"); |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
78 |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
79 %!demo |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
80 %! clf; |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
81 %! plot (1:10, "o-"); |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
82 %! box on; |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
83 %! title ("box on"); |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
84 |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
85 %!demo |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
86 %! clf; |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
87 %! z = [0:0.05:5]; |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
88 %! plot3 (cos (2*pi*z), sin (2*pi*z), z); |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
89 %! box off; |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
90 %! title ("box off"); |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
91 |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
92 %!demo |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
93 %! clf; |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
94 %! z = [0:0.05:5]; |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
95 %! plot3 (cos (2*pi*z), sin (2*pi*z), z); |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
96 %! box on; |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
97 %! set (gca, "boxstyle", "back"); |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
98 %! title ({"box on", 'boxstyle = "back"'}); |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
99 |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
100 %!demo |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
101 %! clf; |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
102 %! z = [0:0.05:5]; |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
103 %! plot3 (cos (2*pi*z), sin (2*pi*z), z); |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
104 %! box on; |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
105 %! set (gca, "boxstyle", "full"); |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
106 %! title ({"box on", 'boxstyle = "full"'}); |