Mercurial > octave
annotate scripts/plot/appearance/box.m @ 28240:2fb684dc2ec2
axis.m: Implement "fill" option for Matlab compatibility.
* axis.m: Document that "fill" is a synonym for "normal". Place "vis3d" option
in documentation table for modes which affect aspect ratio. Add
strcmpi (opt, "fill") to decode opt and executed the same behavior as "normal".
author | Rik <rik@octave.org> |
---|---|
date | Fri, 24 Apr 2020 13:16:09 -0700 |
parents | bd51beb6205e |
children | 0a5b15007766 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 ######################################################################## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 ## |
27919
1891570abac8
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
27918
diff
changeset
|
3 ## Copyright (C) 2006-2020 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27898
diff
changeset
|
4 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 ## See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 ## distribution or <https://octave.org/copyright/>. |
6052 | 7 ## |
8 ## This file is part of Octave. | |
9 ## | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24432
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
6052 | 11 ## 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
|
12 ## 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
|
13 ## (at your option) any later version. |
6052 | 14 ## |
15 ## Octave is distributed in the hope that it will be useful, but | |
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22363
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22363
diff
changeset
|
18 ## GNU General Public License for more details. |
6052 | 19 ## |
20 ## You should have received a copy of the GNU General Public License | |
7016 | 21 ## 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
|
22 ## <https://www.gnu.org/licenses/>. |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 ## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 ######################################################################## |
6052 | 25 |
26 ## -*- texinfo -*- | |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20178
diff
changeset
|
27 ## @deftypefn {} {} box |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20178
diff
changeset
|
28 ## @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
|
29 ## @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
|
30 ## @deftypefnx {} {} box (@var{hax}, @dots{}) |
24431
0c6cedafc71e
doc: Use 'axes' rather than 'axis' appropriately in docstrings.
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
31 ## 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
|
32 ## |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17122
diff
changeset
|
33 ## 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
|
34 ## 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
|
35 ## |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
36 ## 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
|
37 ## 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
|
38 ## @seealso{axis, grid} |
6052 | 39 ## @end deftypefn |
40 | |
6257 | 41 function box (varargin) |
42 | |
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
|
43 [hax, varargin, nargs] = __plt_get_axis_arg__ ("box", varargin{:}); |
6257 | 44 |
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 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
|
46 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
|
47 endif |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
48 |
6257 | 49 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
|
50 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
|
51 if (strcmp (box_state, "on")) |
6257 | 52 box_state = "off"; |
53 else | |
54 box_state = "on"; | |
55 endif | |
56 elseif (nargs == 1) | |
57 state = varargin{1}; | |
58 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
|
59 if (strcmpi (state, "off")) |
10549 | 60 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
|
61 elseif (strcmpi (state, "on")) |
10549 | 62 box_state = "on"; |
6257 | 63 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
|
64 error ('box: argument must be "on" or "off"'); |
6257 | 65 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
|
66 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
|
67 error ('box: argument must be "on" or "off"'); |
6257 | 68 endif |
69 else | |
70 print_usage (); | |
71 endif | |
72 | |
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
|
73 set (hax, "box", box_state); |
6052 | 74 |
75 endfunction | |
17338
1c89599167a6
maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
76 |
22363
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
77 |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
78 %!demo |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
79 %! clf; |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
80 %! plot (1:10, "o-"); |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
81 %! box off; |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
82 %! title ("box off"); |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
83 |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
84 %!demo |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
85 %! clf; |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
86 %! plot (1:10, "o-"); |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
87 %! box on; |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
88 %! title ("box on"); |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
89 |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
90 %!demo |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
91 %! clf; |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
92 %! z = [0:0.05:5]; |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
93 %! plot3 (cos (2*pi*z), sin (2*pi*z), z); |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
94 %! box off; |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
95 %! title ("box off"); |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
96 |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
97 %!demo |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
98 %! clf; |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
99 %! z = [0:0.05:5]; |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
100 %! plot3 (cos (2*pi*z), sin (2*pi*z), z); |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
101 %! box on; |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
102 %! set (gca, "boxstyle", "back"); |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
103 %! title ({"box on", 'boxstyle = "back"'}); |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
104 |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
105 %!demo |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
106 %! clf; |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
107 %! z = [0:0.05:5]; |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
108 %! plot3 (cos (2*pi*z), sin (2*pi*z), z); |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
109 %! box on; |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
110 %! set (gca, "boxstyle", "full"); |
0ca341841198
Implement "boxstyle" graphics property.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
111 %! title ({"box on", 'boxstyle = "full"'}); |