Mercurial > octave
annotate scripts/plot/appearance/axis.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 | 50d83252f867 |
children | 0de38a6ef693 |
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) 1994-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/>. |
2313 | 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 |
2313 | 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:
22510
diff
changeset
|
13 ## (at your option) any later version. |
2313 | 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:
22510
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22510
diff
changeset
|
18 ## GNU General Public License for more details. |
2313 | 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 ######################################################################## |
590 | 25 |
3368 | 26 ## -*- texinfo -*- |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20778
diff
changeset
|
27 ## @deftypefn {} {} axis () |
22163
ae89334cb536
Support setting colormap min max with axis.m (bug #48566).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
28 ## @deftypefnx {} {} axis ([@var{x_lo} @var{x_hi}]) |
ae89334cb536
Support setting colormap min max with axis.m (bug #48566).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
29 ## @deftypefnx {} {} axis ([@var{x_lo} @var{x_hi} @var{y_lo} @var{y_hi}]) |
ae89334cb536
Support setting colormap min max with axis.m (bug #48566).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
30 ## @deftypefnx {} {} axis ([@var{x_lo} @var{x_hi} @var{y_lo} @var{y_hi} @var{z_lo} @var{z_hi}]) |
ae89334cb536
Support setting colormap min max with axis.m (bug #48566).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
31 ## @deftypefnx {} {} axis ([@var{x_lo} @var{x_hi} @var{y_lo} @var{y_hi} @var{z_lo} @var{z_hi} @var{c_lo} @var{c_hi}]) |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20778
diff
changeset
|
32 ## @deftypefnx {} {} axis (@var{option}) |
22814 | 33 ## @deftypefnx {} {} axis (@var{option1}, @var{option2}, @dots{}) |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20778
diff
changeset
|
34 ## @deftypefnx {} {} axis (@var{hax}, @dots{}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20778
diff
changeset
|
35 ## @deftypefnx {} {@var{limits} =} axis () |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17045
diff
changeset
|
36 ## Set axis limits and appearance. |
3426 | 37 ## |
22163
ae89334cb536
Support setting colormap min max with axis.m (bug #48566).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
38 ## The argument @var{limits} should be a 2-, 4-, 6-, or 8-element vector. The |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
39 ## first and second elements specify the lower and upper limits for the |
22163
ae89334cb536
Support setting colormap min max with axis.m (bug #48566).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
40 ## x-axis. The third and fourth specify the limits for the y-axis, the fifth |
ae89334cb536
Support setting colormap min max with axis.m (bug #48566).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
41 ## and sixth specify the limits for the z-axis, and the seventh and eighth |
28238 | 42 ## specify the limits for the color axis. The special values @code{-Inf} and |
43 ## @code{Inf} may be used to indicate that the limit should be automatically | |
44 ## computed based on the data in the axes. | |
3426 | 45 ## |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
46 ## Without any arguments, @code{axis} turns autoscaling on. |
4945 | 47 ## |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17045
diff
changeset
|
48 ## With one output argument, @code{@var{limits} = axis} returns the current |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17045
diff
changeset
|
49 ## axis limits. |
3667 | 50 ## |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19880
diff
changeset
|
51 ## The vector argument specifying limits is optional, and additional string |
22814 | 52 ## arguments may be used to specify various axis properties. |
3668 | 53 ## |
3667 | 54 ## The following options control the aspect ratio of the axes. |
55 ## | |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
56 ## @table @asis |
28240
2fb684dc2ec2
axis.m: Implement "fill" option for Matlab compatibility.
Rik <rik@octave.org>
parents:
28238
diff
changeset
|
57 ## @item @qcode{"equal"} |
2fb684dc2ec2
axis.m: Implement "fill" option for Matlab compatibility.
Rik <rik@octave.org>
parents:
28238
diff
changeset
|
58 ## Force x-axis unit distance to equal y-axis (and z-axis) unit distance. |
2fb684dc2ec2
axis.m: Implement "fill" option for Matlab compatibility.
Rik <rik@octave.org>
parents:
28238
diff
changeset
|
59 ## |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17211
diff
changeset
|
60 ## @item @qcode{"square"} |
21808
a4c744194bbb
Add equal data aspect ratio to gnuplot graphics toolkit 3D plots (bug #47974).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
21385
diff
changeset
|
61 ## Force a square axis aspect ratio. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
62 ## |
28240
2fb684dc2ec2
axis.m: Implement "fill" option for Matlab compatibility.
Rik <rik@octave.org>
parents:
28238
diff
changeset
|
63 ## @item @nospell{@qcode{"vis3d"}} |
2fb684dc2ec2
axis.m: Implement "fill" option for Matlab compatibility.
Rik <rik@octave.org>
parents:
28238
diff
changeset
|
64 ## Set aspect ratio modes (@qcode{"DataAspectRatio"}, |
2fb684dc2ec2
axis.m: Implement "fill" option for Matlab compatibility.
Rik <rik@octave.org>
parents:
28238
diff
changeset
|
65 ## @qcode{"PlotBoxAspectRatio"}) to @qcode{"manual"} for rotation without |
2fb684dc2ec2
axis.m: Implement "fill" option for Matlab compatibility.
Rik <rik@octave.org>
parents:
28238
diff
changeset
|
66 ## stretching. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
67 ## |
28240
2fb684dc2ec2
axis.m: Implement "fill" option for Matlab compatibility.
Rik <rik@octave.org>
parents:
28238
diff
changeset
|
68 ## @item @qcode{"normal"} |
2fb684dc2ec2
axis.m: Implement "fill" option for Matlab compatibility.
Rik <rik@octave.org>
parents:
28238
diff
changeset
|
69 ## @itemx @qcode{"fill"} |
2fb684dc2ec2
axis.m: Implement "fill" option for Matlab compatibility.
Rik <rik@octave.org>
parents:
28238
diff
changeset
|
70 ## Restore default automatically computed aspect ratios. |
3667 | 71 ## @end table |
72 ## | |
73 ## @noindent | |
74 ## The following options control the way axis limits are interpreted. | |
75 ## | |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
76 ## @table @asis |
22814 | 77 ## @item @qcode{"auto"} |
78 ## @itemx @qcode{"auto[xyz]"} | |
28238 | 79 ## @itemx @qcode{"auto [xyz]"} |
80 ## Set nice auto-computed limits around the data for all axes, or only | |
81 ## the specified axes. | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
82 ## |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17211
diff
changeset
|
83 ## @item @qcode{"manual"} |
3667 | 84 ## Fix the current axes limits. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
85 ## |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17211
diff
changeset
|
86 ## @item @qcode{"tight"} |
9277
be84e9654feb
Update axis.m documentation to reflect addition of "tight" option.
Rik <rdrider0-list@yahoo.com>
parents:
9209
diff
changeset
|
87 ## Fix axes to the limits of the data. |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17045
diff
changeset
|
88 ## |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17211
diff
changeset
|
89 ## @item @qcode{"image"} |
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17211
diff
changeset
|
90 ## Equivalent to @qcode{"tight"} and @qcode{"equal"}. |
23272
3983ac6f5920
axis.m: Add support for "vis3d" (bug #50523).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23220
diff
changeset
|
91 ## |
3667 | 92 ## @end table |
93 ## | |
94 ## @noindent | |
22163
ae89334cb536
Support setting colormap min max with axis.m (bug #48566).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
95 ## The following options affect the appearance of tick marks. |
3667 | 96 ## |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
97 ## @table @asis |
28238 | 98 ## @item @qcode{"tic"} |
99 ## @itemx @qcode{"tic[xyz]"} | |
100 ## @itemx @qcode{"tic [xyz]"} | |
22163
ae89334cb536
Support setting colormap min max with axis.m (bug #48566).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
101 ## Turn tick marks on for all axes, or turn them on for the specified axes and |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19880
diff
changeset
|
102 ## off for the remainder. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
103 ## |
28238 | 104 ## @item @qcode{"label"} |
105 ## @itemx @qcode{"label[xyz]"} | |
106 ## @itemx @qcode{"label [xyz]"} | |
22163
ae89334cb536
Support setting colormap min max with axis.m (bug #48566).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
107 ## Turn tick labels on for all axes, or turn them on for the specified axes |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19880
diff
changeset
|
108 ## and off for the remainder. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
109 ## |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17211
diff
changeset
|
110 ## @item @qcode{"nolabel"} |
22163
ae89334cb536
Support setting colormap min max with axis.m (bug #48566).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
111 ## Turn tick labels off for all axes. |
3667 | 112 ## @end table |
15007
8f0e3c5bfa5f
doc: Periodic grammarcheck of documentation
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
113 ## |
24431
0c6cedafc71e
doc: Use 'axes' rather than 'axis' appropriately in docstrings.
Rik <rik@octave.org>
parents:
23219
diff
changeset
|
114 ## Note: If there are no tick marks for an axes then there can be no labels. |
3667 | 115 ## |
116 ## @noindent | |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17045
diff
changeset
|
117 ## The following options affect the direction of increasing values on the axes. |
3667 | 118 ## |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
119 ## @table @asis |
22814 | 120 ## @item @qcode{"xy"} |
121 ## Default y-axis, larger values are near the top. | |
122 ## | |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17211
diff
changeset
|
123 ## @item @qcode{"ij"} |
22814 | 124 ## Reverse y-axis, smaller values are near the top. |
125 ## @end table | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
126 ## |
22814 | 127 ## @noindent |
128 ## The following options affects the visibility of the axes. | |
129 ## | |
130 ## @table @asis | |
131 ## @item @qcode{"on"} | |
132 ## Make the axes visible. | |
133 ## | |
134 ## @item @qcode{"off"} | |
135 ## Hide the axes. | |
3667 | 136 ## @end table |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
137 ## |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19880
diff
changeset
|
138 ## If the first argument @var{hax} is an axes handle, then operate on this |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19880
diff
changeset
|
139 ## axes rather than the current axes returned by @code{gca}. |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17045
diff
changeset
|
140 ## |
22814 | 141 ## Example 1: set X/Y limits and force a square aspect ratio |
142 ## | |
143 ## @example | |
144 ## axis ([1, 2, 3, 4], "square"); | |
145 ## @end example | |
146 ## | |
147 ## Example 2: enable tick marks on all axes, | |
148 ## enable tick mark labels only on the y-axis | |
149 ## | |
150 ## @example | |
151 ## axis ("tic", "labely"); | |
152 ## @end example | |
153 ## | |
154 ## @seealso{xlim, ylim, zlim, caxis, daspect, pbaspect, box, grid} | |
3368 | 155 ## @end deftypefn |
590 | 156 |
17045
6dec8dbf8a97
axis.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
17026
diff
changeset
|
157 function limits = axis (varargin) |
590 | 158 |
17045
6dec8dbf8a97
axis.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
17026
diff
changeset
|
159 [hax, varargin, nargin] = __plt_get_axis_arg__ ("axis", varargin{:}); |
7216 | 160 |
17211
87ba70043bfc
Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents:
17190
diff
changeset
|
161 oldfig = []; |
17301
68bcac3c043a
Correct inversion accidentally introduced in cset 87ba70043bfc.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
162 if (! isempty (hax)) |
17211
87ba70043bfc
Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents:
17190
diff
changeset
|
163 oldfig = get (0, "currentfigure"); |
87ba70043bfc
Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents:
17190
diff
changeset
|
164 endif |
7215 | 165 unwind_protect |
17045
6dec8dbf8a97
axis.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
17026
diff
changeset
|
166 if (isempty (hax)) |
6dec8dbf8a97
axis.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
17026
diff
changeset
|
167 hax = gca (); |
6dec8dbf8a97
axis.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
17026
diff
changeset
|
168 endif |
6dec8dbf8a97
axis.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
17026
diff
changeset
|
169 if (nargin == 0) |
6dec8dbf8a97
axis.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
17026
diff
changeset
|
170 limits = __axis__ (hax, varargin{:}); |
7189 | 171 else |
17045
6dec8dbf8a97
axis.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
17026
diff
changeset
|
172 __axis__ (hax, varargin{:}); |
7189 | 173 endif |
7215 | 174 unwind_protect_cleanup |
17045
6dec8dbf8a97
axis.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
17026
diff
changeset
|
175 if (! isempty (oldfig)) |
6dec8dbf8a97
axis.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
17026
diff
changeset
|
176 set (0, "currentfigure", oldfig); |
6dec8dbf8a97
axis.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
17026
diff
changeset
|
177 endif |
7215 | 178 end_unwind_protect |
590 | 179 |
7189 | 180 endfunction |
181 | |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
182 function limits = __axis__ (ca, varargin) |
7189 | 183 |
184 if (nargin == 1) | |
4945 | 185 if (nargout == 0) |
6257 | 186 set (ca, "xlimmode", "auto", "ylimmode", "auto", "zlimmode", "auto"); |
4945 | 187 else |
6257 | 188 xlim = get (ca, "xlim"); |
189 ylim = get (ca, "ylim"); | |
9427
7b74a7fd4761
axis: return 4-element vector for 2-d view
John W. Eaton <jwe@octave.org>
parents:
9357
diff
changeset
|
190 view = get (ca, "view"); |
7b74a7fd4761
axis: return 4-element vector for 2-d view
John W. Eaton <jwe@octave.org>
parents:
9357
diff
changeset
|
191 if (view(2) == 90) |
17045
6dec8dbf8a97
axis.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
17026
diff
changeset
|
192 limits = [xlim, ylim]; |
9427
7b74a7fd4761
axis: return 4-element vector for 2-d view
John W. Eaton <jwe@octave.org>
parents:
9357
diff
changeset
|
193 else |
10549 | 194 zlim = get (ca, "zlim"); |
17045
6dec8dbf8a97
axis.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
17026
diff
changeset
|
195 limits = [xlim, ylim, zlim]; |
9427
7b74a7fd4761
axis: return 4-element vector for 2-d view
John W. Eaton <jwe@octave.org>
parents:
9357
diff
changeset
|
196 endif |
4945 | 197 endif |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
198 return; |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
199 endif |
3667 | 200 |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
201 for arg = varargin |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
202 opt = arg{1}; |
3667 | 203 |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
204 if (ischar (opt)) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
205 len = length (opt); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
206 |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
207 ## 'matrix mode' to reverse the y-axis |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
208 if (strcmpi (opt, "ij")) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
209 set (ca, "ydir", "reverse"); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
210 elseif (strcmpi (opt, "xy")) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
211 set (ca, "ydir", "normal"); |
3667 | 212 |
213 ## aspect ratio | |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
214 elseif (strcmpi (opt, "image")) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
215 __axis__ (ca, "equal"); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
216 set (ca, "plotboxaspectratiomode", "auto"); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
217 __do_tight_option__ (ca); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
218 elseif (strcmpi (opt, "square")) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
219 set (ca, "dataaspectratiomode", "auto", |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
220 "plotboxaspectratio", [1, 1, 1]); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
221 elseif (strcmp (opt, "equal")) |
26664
a7dfb00d5bf5
axis.m: Fix issues with "equal" argument (bug #55619, bug #55614, bug #55574, bug #55514, bug #54848, bug #53724, bug #53504, bug #53336, bug #51938, bug #50356).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
222 is2dview = (get (ca, "view")(2) == 90); |
a7dfb00d5bf5
axis.m: Fix issues with "equal" argument (bug #55619, bug #55614, bug #55574, bug #55514, bug #54848, bug #53724, bug #53504, bug #53336, bug #51938, bug #50356).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
223 if (is2dview) |
a7dfb00d5bf5
axis.m: Fix issues with "equal" argument (bug #55619, bug #55614, bug #55574, bug #55514, bug #54848, bug #53724, bug #53504, bug #53336, bug #51938, bug #50356).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
224 ## Save & later restore axes aspect ratio |
a7dfb00d5bf5
axis.m: Fix issues with "equal" argument (bug #55619, bug #55614, bug #55574, bug #55514, bug #54848, bug #53724, bug #53504, bug #53336, bug #51938, bug #50356).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
225 ca_units = get (ca, "units"); |
a7dfb00d5bf5
axis.m: Fix issues with "equal" argument (bug #55619, bug #55614, bug #55574, bug #55514, bug #54848, bug #53724, bug #53504, bug #53336, bug #51938, bug #50356).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
226 set (ca, "units", "pixels"); |
a7dfb00d5bf5
axis.m: Fix issues with "equal" argument (bug #55619, bug #55614, bug #55574, bug #55514, bug #54848, bug #53724, bug #53504, bug #53336, bug #51938, bug #50356).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
227 axis_pos = get (ca, "position"); |
a7dfb00d5bf5
axis.m: Fix issues with "equal" argument (bug #55619, bug #55614, bug #55574, bug #55514, bug #54848, bug #53724, bug #53504, bug #53336, bug #51938, bug #50356).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
228 set (ca, "units", ca_units); |
a7dfb00d5bf5
axis.m: Fix issues with "equal" argument (bug #55619, bug #55614, bug #55574, bug #55514, bug #54848, bug #53724, bug #53504, bug #53336, bug #51938, bug #50356).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
229 pbratio = [axis_pos(3), axis_pos(4), axis_pos(4)]; |
a7dfb00d5bf5
axis.m: Fix issues with "equal" argument (bug #55619, bug #55614, bug #55574, bug #55514, bug #54848, bug #53724, bug #53504, bug #53336, bug #51938, bug #50356).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
230 endif |
22510
00bf2e2de581
Keep aspect ratio of axes for "axis equal" (bug #49038).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22489
diff
changeset
|
231 |
26664
a7dfb00d5bf5
axis.m: Fix issues with "equal" argument (bug #55619, bug #55614, bug #55574, bug #55514, bug #54848, bug #53724, bug #53504, bug #53336, bug #51938, bug #50356).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
232 daratio = get (ca, "dataaspectratio"); |
a7dfb00d5bf5
axis.m: Fix issues with "equal" argument (bug #55619, bug #55614, bug #55574, bug #55514, bug #54848, bug #53724, bug #53504, bug #53336, bug #51938, bug #50356).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
233 if (all (daratio != [1, 1, 1])) |
a7dfb00d5bf5
axis.m: Fix issues with "equal" argument (bug #55619, bug #55614, bug #55574, bug #55514, bug #54848, bug #53724, bug #53504, bug #53336, bug #51938, bug #50356).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
234 set (ca, "dataaspectratio", [1, 1, 1]); |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
235 else |
26664
a7dfb00d5bf5
axis.m: Fix issues with "equal" argument (bug #55619, bug #55614, bug #55574, bug #55514, bug #54848, bug #53724, bug #53504, bug #53336, bug #51938, bug #50356).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
236 set (ca, "dataaspectratio", [1+eps, 1, 1], |
a7dfb00d5bf5
axis.m: Fix issues with "equal" argument (bug #55619, bug #55614, bug #55574, bug #55514, bug #54848, bug #53724, bug #53504, bug #53336, bug #51938, bug #50356).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
237 "dataaspectratio", [1, 1, 1]); |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
238 endif |
26664
a7dfb00d5bf5
axis.m: Fix issues with "equal" argument (bug #55619, bug #55614, bug #55574, bug #55514, bug #54848, bug #53724, bug #53504, bug #53336, bug #51938, bug #50356).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
239 |
a7dfb00d5bf5
axis.m: Fix issues with "equal" argument (bug #55619, bug #55614, bug #55574, bug #55514, bug #54848, bug #53724, bug #53504, bug #53336, bug #51938, bug #50356).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
240 ## Matlab only adjusts plotboxaspectratio for 2-D figures, but |
a7dfb00d5bf5
axis.m: Fix issues with "equal" argument (bug #55619, bug #55614, bug #55574, bug #55514, bug #54848, bug #53724, bug #53504, bug #53336, bug #51938, bug #50356).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
241 ## Octave needs to do it for 3-D as well. |
a7dfb00d5bf5
axis.m: Fix issues with "equal" argument (bug #55619, bug #55614, bug #55574, bug #55514, bug #54848, bug #53724, bug #53504, bug #53336, bug #51938, bug #50356).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
242 if (is2dview) |
a7dfb00d5bf5
axis.m: Fix issues with "equal" argument (bug #55619, bug #55614, bug #55574, bug #55514, bug #54848, bug #53724, bug #53504, bug #53336, bug #51938, bug #50356).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
243 set (ca, "plotboxaspectratio", pbratio); |
a7dfb00d5bf5
axis.m: Fix issues with "equal" argument (bug #55619, bug #55614, bug #55574, bug #55514, bug #54848, bug #53724, bug #53504, bug #53336, bug #51938, bug #50356).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
244 else |
a7dfb00d5bf5
axis.m: Fix issues with "equal" argument (bug #55619, bug #55614, bug #55574, bug #55514, bug #54848, bug #53724, bug #53504, bug #53336, bug #51938, bug #50356).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
245 pbratio = get (ca, "plotboxaspectratio"); |
a7dfb00d5bf5
axis.m: Fix issues with "equal" argument (bug #55619, bug #55614, bug #55574, bug #55514, bug #54848, bug #53724, bug #53504, bug #53336, bug #51938, bug #50356).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
246 if (all (pbratio != [1, 1, 1])) |
a7dfb00d5bf5
axis.m: Fix issues with "equal" argument (bug #55619, bug #55614, bug #55574, bug #55514, bug #54848, bug #53724, bug #53504, bug #53336, bug #51938, bug #50356).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
247 set (ca, "plotboxaspectratio", [1, 1, 1]); |
a7dfb00d5bf5
axis.m: Fix issues with "equal" argument (bug #55619, bug #55614, bug #55574, bug #55514, bug #54848, bug #53724, bug #53504, bug #53336, bug #51938, bug #50356).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
248 else |
a7dfb00d5bf5
axis.m: Fix issues with "equal" argument (bug #55619, bug #55614, bug #55574, bug #55514, bug #54848, bug #53724, bug #53504, bug #53336, bug #51938, bug #50356).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
249 set (ca, "plotboxaspectratio", [1+eps, 1, 1], |
a7dfb00d5bf5
axis.m: Fix issues with "equal" argument (bug #55619, bug #55614, bug #55574, bug #55514, bug #54848, bug #53724, bug #53504, bug #53336, bug #51938, bug #50356).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
250 "plotboxaspectratio", [1, 1, 1]); |
a7dfb00d5bf5
axis.m: Fix issues with "equal" argument (bug #55619, bug #55614, bug #55574, bug #55514, bug #54848, bug #53724, bug #53504, bug #53336, bug #51938, bug #50356).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
251 endif |
a7dfb00d5bf5
axis.m: Fix issues with "equal" argument (bug #55619, bug #55614, bug #55574, bug #55514, bug #54848, bug #53724, bug #53504, bug #53336, bug #51938, bug #50356).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
252 endif |
23272
3983ac6f5920
axis.m: Add support for "vis3d" (bug #50523).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23220
diff
changeset
|
253 elseif (strcmpi (opt, "vis3d")) |
3983ac6f5920
axis.m: Add support for "vis3d" (bug #50523).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23220
diff
changeset
|
254 ## Fix aspect ratio modes for rotation without stretching. |
3983ac6f5920
axis.m: Add support for "vis3d" (bug #50523).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23220
diff
changeset
|
255 set (ca, "dataaspectratiomode", "manual", |
3983ac6f5920
axis.m: Add support for "vis3d" (bug #50523).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23220
diff
changeset
|
256 "plotboxaspectratiomode", "manual"); |
28240
2fb684dc2ec2
axis.m: Implement "fill" option for Matlab compatibility.
Rik <rik@octave.org>
parents:
28238
diff
changeset
|
257 elseif (strcmpi (opt, "normal") || strcmpi (opt, "fill")) |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
258 ## Set plotboxaspectratio to something obtuse so that switching |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
259 ## back to "auto" will force a re-calculation. |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
260 set (ca, "plotboxaspectratio", [3 2 1]); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
261 set (ca, "plotboxaspectratiomode", "auto", |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
262 "dataaspectratiomode", "auto"); |
3667 | 263 |
264 ## axis limits | |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
265 elseif (strncmpi (opt, "auto", 4)) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
266 if (len == 4) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
267 set (ca, "xlimmode", "auto", "ylimmode", "auto", "zlimmode", "auto"); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
268 else |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
269 if (any (opt == "x")) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
270 set (ca, "xlimmode", "auto"); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
271 endif |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
272 if (any (opt == "y")) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
273 set (ca, "ylimmode", "auto"); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
274 endif |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
275 if (any (opt == "z")) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
276 set (ca, "zlimmode", "auto"); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
277 endif |
10549 | 278 endif |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
279 elseif (strcmpi (opt, "manual")) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
280 ## fixes the axis limits |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
281 set (ca, "xlimmode", "manual", "ylimmode", "manual", |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
282 "zlimmode", "manual"); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
283 elseif (strcmpi (opt, "tight")) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
284 ## sets the axis limits to the min and max of all data. |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
285 __do_tight_option__ (ca); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
286 |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
287 ## visibility |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
288 elseif (strcmpi (opt, "on")) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
289 set (ca, "visible", "on"); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
290 elseif (strcmpi (opt, "off")) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
291 set (ca, "visible", "off"); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
292 |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
293 ## tick marks |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
294 elseif (strcmpi (opt, "tic")) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
295 set (ca, "xtickmode", "auto", "ytickmode", "auto", "ztickmode", "auto", |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
296 "visible", "on"); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
297 elseif (strncmpi (opt, "tic", 3)) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
298 if (any (opt == "x")) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
299 set (ca, "xtickmode", "auto"); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
300 else |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
301 set (ca, "xtick", []); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
302 endif |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
303 if (any (opt == "y")) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
304 set (ca, "ytickmode", "auto"); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
305 else |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
306 set (ca, "ytick", []); |
10549 | 307 endif |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
308 if (any (opt == "z")) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
309 set (ca, "ztickmode", "auto"); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
310 else |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
311 set (ca, "ztick", []); |
10549 | 312 endif |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
313 |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
314 ## labels |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
315 elseif (strcmpi (opt, "label")) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
316 set (ca, "xticklabelmode", "auto", "yticklabelmode", "auto", |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
317 "zticklabelmode", "auto"); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
318 elseif (strcmpi (opt, "nolabel")) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
319 set (ca, "xticklabel", {}, "yticklabel", {}, "zticklabel", {}) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
320 elseif (strncmpi (opt, "label", 5)) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
321 if (any (opt == "x")) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
322 set (ca, "xticklabelmode", "auto"); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
323 else |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
324 set (ca, "xticklabel", ""); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
325 endif |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
326 if (any (opt == "y")) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
327 set (ca, "yticklabelmode", "auto"); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
328 else |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
329 set (ca, "yticklabel", ""); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
330 endif |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
331 if (any (opt == "z")) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
332 set (ca, "zticklabelmode", "auto"); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
333 else |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
334 set (ca, "zticklabel", ""); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
335 endif |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
336 |
3667 | 337 else |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
338 warning ("axis: unknown option '%s'", opt); |
8953
a6945f92b868
__go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents:
8920
diff
changeset
|
339 endif |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
340 |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
341 elseif (isnumeric (opt) && isvector (opt)) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
342 |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
343 len = length (opt); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
344 |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
345 if (len != 2 && len != 4 && len != 6 && len != 8) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
346 error ("axis: LIMITS vector must have 2, 4, 6, or 8 elements"); |
3667 | 347 endif |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
348 |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
349 for i = 1:2:len |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
350 if (opt(i) >= opt(i+1)) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
351 error ("axis: LIMITS(%d) must be less than LIMITS(%d)", i, i+1); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
352 endif |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
353 endfor |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
354 |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
355 if (len > 1) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
356 xlim (ca, opt(1:2)); |
3667 | 357 endif |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
358 |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
359 if (len > 3) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
360 ylim (ca, opt(3:4)); |
3667 | 361 endif |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
362 |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
363 if (len > 5) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
364 zlim (ca, opt(5:6)); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
365 endif |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
366 |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
367 if (len > 7) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
368 caxis (ca, opt(7:8)); |
3667 | 369 endif |
370 | |
371 else | |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
372 error ("axis: expecting no args, or a numeric vector with 2, 4, 6, or 8 elements"); |
590 | 373 endif |
374 | |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
375 endfor |
590 | 376 endfunction |
3667 | 377 |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
378 ## Find the limits for axis ("tight"). |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
379 ## AX should be one of "x", "y", or "z". |
7376 | 380 function lims = __get_tight_lims__ (ca, ax) |
381 | |
20778
8513c84a13cb
Use parser string concatenation rather than strcat() for performance in m-files.
Rik <rik@octave.org>
parents:
20727
diff
changeset
|
382 kids = findobj (ca, "-property", [ax "data"]); |
14054
ec79cd8359c5
Ignore Inf when determining tight axis limits.
Ben Abbott <bpabbott@mac.com>
parents:
13322
diff
changeset
|
383 ## The data properties for hggroups mirror their children. |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
384 ## Exclude the redundant hggroup values. |
14054
ec79cd8359c5
Ignore Inf when determining tight axis limits.
Ben Abbott <bpabbott@mac.com>
parents:
13322
diff
changeset
|
385 hg_kids = findobj (kids, "type", "hggroup"); |
11174
2114867f2a50
axis.m: Exclude hggroup {x,y,z}data properties when determing tight axis limits.
Ben Abbott <bpabbott@mac.com>
parents:
11001
diff
changeset
|
386 kids = setdiff (kids, hg_kids); |
7376 | 387 if (isempty (kids)) |
388 ## Return the current limits. | |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
389 ## FIXME: Is this the correct thing to do? |
20778
8513c84a13cb
Use parser string concatenation rather than strcat() for performance in m-files.
Rik <rik@octave.org>
parents:
20727
diff
changeset
|
390 lims = get (ca, [ax "lim"]); |
7376 | 391 else |
20778
8513c84a13cb
Use parser string concatenation rather than strcat() for performance in m-files.
Rik <rik@octave.org>
parents:
20727
diff
changeset
|
392 data = get (kids, [ax "data"]); |
18524
bf0d2e51c8f0
axis.m: make 'tight' embrace whole images (bug #36594).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18475
diff
changeset
|
393 types = get (kids, "type"); |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
18668
diff
changeset
|
394 |
20778
8513c84a13cb
Use parser string concatenation rather than strcat() for performance in m-files.
Rik <rik@octave.org>
parents:
20727
diff
changeset
|
395 scale = get (ca, [ax "scale"]); |
14054
ec79cd8359c5
Ignore Inf when determining tight axis limits.
Ben Abbott <bpabbott@mac.com>
parents:
13322
diff
changeset
|
396 if (! iscell (data)) |
ec79cd8359c5
Ignore Inf when determining tight axis limits.
Ben Abbott <bpabbott@mac.com>
parents:
13322
diff
changeset
|
397 data = {data}; |
14552
86854d032a37
maint: miscellaneous style fixes for .m files
John W. Eaton <jwe@octave.org>
parents:
14247
diff
changeset
|
398 endif |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
18668
diff
changeset
|
399 |
18524
bf0d2e51c8f0
axis.m: make 'tight' embrace whole images (bug #36594).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18475
diff
changeset
|
400 ## Extend image data one pixel |
bf0d2e51c8f0
axis.m: make 'tight' embrace whole images (bug #36594).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18475
diff
changeset
|
401 idx = strcmp (types, "image"); |
18668
01aa90ece9a4
axis.m: Fix regression setting tight limits on non-image objects.
Rik <rik@octave.org>
parents:
18524
diff
changeset
|
402 if (any (idx) && (ax == "x" || ax == "y")) |
18524
bf0d2e51c8f0
axis.m: make 'tight' embrace whole images (bug #36594).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18475
diff
changeset
|
403 imdata = data(idx); |
bf0d2e51c8f0
axis.m: make 'tight' embrace whole images (bug #36594).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18475
diff
changeset
|
404 px = arrayfun (@__image_pixel_size__, kids(idx), "uniformoutput", false); |
bf0d2e51c8f0
axis.m: make 'tight' embrace whole images (bug #36594).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18475
diff
changeset
|
405 ipx = ifelse (ax == "x", 1, 2); |
bf0d2e51c8f0
axis.m: make 'tight' embrace whole images (bug #36594).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18475
diff
changeset
|
406 imdata = cellfun (@(x,dx) [(min (x) - dx(ipx)), (max (x) + dx(ipx))], |
bf0d2e51c8f0
axis.m: make 'tight' embrace whole images (bug #36594).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18475
diff
changeset
|
407 imdata, px, "uniformoutput", false); |
bf0d2e51c8f0
axis.m: make 'tight' embrace whole images (bug #36594).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18475
diff
changeset
|
408 data(idx) = imdata; |
bf0d2e51c8f0
axis.m: make 'tight' embrace whole images (bug #36594).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18475
diff
changeset
|
409 endif |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
18668
diff
changeset
|
410 |
14054
ec79cd8359c5
Ignore Inf when determining tight axis limits.
Ben Abbott <bpabbott@mac.com>
parents:
13322
diff
changeset
|
411 if (strcmp (scale, "log")) |
14063
6875d23ce051
Fix regression of tight axis limits introduced by changeset ec79cd8359c5.
Ben Abbott <bpabbott@mac.com>
parents:
14054
diff
changeset
|
412 tmp = data; |
6875d23ce051
Fix regression of tight axis limits introduced by changeset ec79cd8359c5.
Ben Abbott <bpabbott@mac.com>
parents:
14054
diff
changeset
|
413 data = cellfun (@(x) x(x>0), tmp, "uniformoutput", false); |
17426
aa380b380315
axis.m: Fix bug when data sets differ in size and dimension (bug #40036).
Rik <rik@octave.org>
parents:
17386
diff
changeset
|
414 n = cellfun ("isempty", data); |
14063
6875d23ce051
Fix regression of tight axis limits introduced by changeset ec79cd8359c5.
Ben Abbott <bpabbott@mac.com>
parents:
14054
diff
changeset
|
415 data(n) = cellfun (@(x) x(x<0), tmp(n), "uniformoutput", false); |
13174
bd2cd4fd3edf
maint: use specific endif, endfor tokens instead of simple end
John W. Eaton <jwe@octave.org>
parents:
13154
diff
changeset
|
416 endif |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14552
diff
changeset
|
417 data = cellfun (@(x) x(isfinite (x)), data, "uniformoutput", false); |
14054
ec79cd8359c5
Ignore Inf when determining tight axis limits.
Ben Abbott <bpabbott@mac.com>
parents:
13322
diff
changeset
|
418 data = data(! cellfun ("isempty", data)); |
ec79cd8359c5
Ignore Inf when determining tight axis limits.
Ben Abbott <bpabbott@mac.com>
parents:
13322
diff
changeset
|
419 if (! isempty (data)) |
17426
aa380b380315
axis.m: Fix bug when data sets differ in size and dimension (bug #40036).
Rik <rik@octave.org>
parents:
17386
diff
changeset
|
420 ## Change data from cell array of various sizes to a single column vector |
aa380b380315
axis.m: Fix bug when data sets differ in size and dimension (bug #40036).
Rik <rik@octave.org>
parents:
17386
diff
changeset
|
421 data = cat (1, cellindexmat (data, ":"){:}); |
aa380b380315
axis.m: Fix bug when data sets differ in size and dimension (bug #40036).
Rik <rik@octave.org>
parents:
17386
diff
changeset
|
422 lims = [min(data), max(data)]; |
7376 | 423 else |
14054
ec79cd8359c5
Ignore Inf when determining tight axis limits.
Ben Abbott <bpabbott@mac.com>
parents:
13322
diff
changeset
|
424 lims = [0, 1]; |
8610
85c9906abfd1
use endif and endfor instead of end
John W. Eaton <jwe@octave.org>
parents:
8507
diff
changeset
|
425 endif |
85c9906abfd1
use endif and endfor instead of end
John W. Eaton <jwe@octave.org>
parents:
8507
diff
changeset
|
426 endif |
9357
95ec56601497
axis.m: Fix bug for 'axis tight' with multiple surface plots, add demo.
Ben Abbott <bpabbott@mac.com>
parents:
9317
diff
changeset
|
427 |
7376 | 428 endfunction |
429 | |
430 function __do_tight_option__ (ca) | |
431 | |
17023 | 432 xlim = __get_tight_lims__ (ca, "x"); |
433 if (all (xlim == 0)) | |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
434 xlim = [-eps, +eps]; |
17023 | 435 elseif (diff (xlim == 0)) |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
436 xlim .*= [1-eps, 1+eps]; |
17023 | 437 endif |
438 ylim = __get_tight_lims__ (ca, "y"); | |
439 if (all (ylim == 0)) | |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
440 ylim = [-eps, +eps]; |
17023 | 441 elseif (diff (ylim == 0)) |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
442 ylim .*= [1-eps, 1+eps]; |
17023 | 443 endif |
21385
89fa0694aa2e
Fix check-missing-semicolon QA target (bug #47277).
Rik <rik@octave.org>
parents:
20852
diff
changeset
|
444 set (ca, "xlim", xlim, "ylim", ylim); |
17564
234731d524c2
axis.m: Fix 'axis tight' with pcolor plots.
Rik <rik@octave.org>
parents:
17427
diff
changeset
|
445 nd = __calc_dimensions__ (ca); |
234731d524c2
axis.m: Fix 'axis tight' with pcolor plots.
Rik <rik@octave.org>
parents:
17427
diff
changeset
|
446 is3dview = (get (ca, "view")(2) != 90); |
234731d524c2
axis.m: Fix 'axis tight' with pcolor plots.
Rik <rik@octave.org>
parents:
17427
diff
changeset
|
447 if (nd > 2 && is3dview) |
17023 | 448 zlim = __get_tight_lims__ (ca, "z"); |
449 if (all (zlim == 0)) | |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
450 zlim = [-eps, +eps]; |
17023 | 451 elseif (diff (zlim == 0)) |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
452 zlim .*= [1-eps, 1+eps]; |
17023 | 453 endif |
454 set (ca, "zlim", zlim); | |
11183
ac6a199be45e
Leave zlim unchanged during 'axis tight' on 2D plots
Konstantinos Poulios <logari81@googlemail.com>
parents:
11174
diff
changeset
|
455 endif |
7376 | 456 |
457 endfunction | |
458 | |
17045
6dec8dbf8a97
axis.m: Overhaul to use new __plt_get_axis_arg__.
Rik <rik@octave.org>
parents:
17026
diff
changeset
|
459 |
3667 | 460 %!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
|
461 %! clf; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
462 %! t = 0:0.01:2*pi; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
463 %! x = sin (t); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
464 %! |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
465 %! subplot (221); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
466 %! plot (t, x); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
467 %! title ("normal plot"); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
468 %! |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
469 %! subplot (222); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
470 %! plot (t, x); |
22312
533c3c4059a3
Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents:
22302
diff
changeset
|
471 %! title ("axis square"); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
472 %! axis ("square"); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
473 %! |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
474 %! subplot (223); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
475 %! plot (t, x); |
22312
533c3c4059a3
Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents:
22302
diff
changeset
|
476 %! title ("axis equal"); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
477 %! axis ("equal"); |
3667 | 478 %! |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
479 %! subplot (224); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
480 %! plot (t, x); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
481 %! title ("normal plot again"); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
482 %! axis ("normal"); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
483 |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
484 %!demo |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
485 %! clf; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
486 %! t = 0:0.01:2*pi; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
487 %! x = sin (t); |
3667 | 488 %! |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
489 %! subplot (121); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
490 %! plot (t, x); |
22312
533c3c4059a3
Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents:
22302
diff
changeset
|
491 %! title ({"axis ij", "Y-axis reversed"}); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
492 %! axis ("ij"); |
22312
533c3c4059a3
Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents:
22302
diff
changeset
|
493 %! legend ("sine"); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
494 %! |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
495 %! subplot (122); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
496 %! plot (t, x); |
22312
533c3c4059a3
Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents:
22302
diff
changeset
|
497 %! title ("axis xy"); |
533c3c4059a3
Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents:
22302
diff
changeset
|
498 %! title ({"axis ij", "Y-axis normal"}); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
499 %! axis ("xy"); |
22312
533c3c4059a3
Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents:
22302
diff
changeset
|
500 %! legend ("sine"); |
3667 | 501 |
502 %!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
|
503 %! clf; |
26665
f9dbc287f908
axis.m: Enlarge ticks in %!demo #3 for clarity.
Rik <rik@octave.org>
parents:
26664
diff
changeset
|
504 %! def_ticklen = get (0, "DefaultAxesTickLength"); |
f9dbc287f908
axis.m: Enlarge ticks in %!demo #3 for clarity.
Rik <rik@octave.org>
parents:
26664
diff
changeset
|
505 %! set (0, "DefaultAxesTickLength", [.028, .025]); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
506 %! t = 0:0.01:2*pi; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
507 %! x = sin (t); |
3667 | 508 %! |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
509 %! subplot (331); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
510 %! plot (t, x); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
511 %! title ("x ticks and labels"); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
512 %! axis ("ticx"); |
3667 | 513 %! |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
514 %! subplot (332); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
515 %! plot (t, x); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
516 %! title ("y ticks and labels"); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
517 %! axis ("ticy"); |
3667 | 518 %! |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
519 %! subplot (333); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
520 %! plot (t, x); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
521 %! title ("axis off"); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
522 %! axis ("off"); |
3667 | 523 %! |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
524 %! subplot (334); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
525 %! plot (t, x); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
526 %! title ("x and y ticks, x labels"); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
527 %! axis ("labelx","tic"); |
3667 | 528 %! |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
529 %! subplot (335); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
530 %! plot (t, x); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
531 %! title ("x and y ticks, y labels"); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
532 %! axis ("labely","tic"); |
3667 | 533 %! |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
534 %! subplot (336); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
535 %! plot (t, x); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
536 %! title ("all ticks but no labels"); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
537 %! axis ("nolabel","tic"); |
3667 | 538 %! |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
539 %! subplot (337); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
540 %! plot (t, x); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
541 %! title ("x ticks, no labels"); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
542 %! axis ("nolabel","ticx"); |
3667 | 543 %! |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
544 %! subplot (338); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
545 %! plot (t, x); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
546 %! title ("y ticks, no labels"); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
547 %! axis ("nolabel","ticy"); |
3667 | 548 %! |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
549 %! subplot (339); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
550 %! plot (t, x); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
551 %! title ("all ticks and labels"); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
552 %! axis ("on"); |
26665
f9dbc287f908
axis.m: Enlarge ticks in %!demo #3 for clarity.
Rik <rik@octave.org>
parents:
26664
diff
changeset
|
553 %! |
f9dbc287f908
axis.m: Enlarge ticks in %!demo #3 for clarity.
Rik <rik@octave.org>
parents:
26664
diff
changeset
|
554 %! set (0, "DefaultAxesTickLength", def_ticklen); |
3667 | 555 |
556 %!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
|
557 %! clf; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
558 %! t = 0:0.01:2*pi; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
559 %! x = sin (t); |
3667 | 560 %! |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
561 %! subplot (321); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
562 %! plot (t, x); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
563 %! title ("axes at [0 3 0 1]"); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
564 %! axis ([0,3,0,1]); |
3667 | 565 %! |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
566 %! subplot (322); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
567 %! plot (t, x); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
568 %! title ("auto"); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
569 %! axis ("auto"); |
3667 | 570 %! |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
571 %! subplot (323); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
572 %! plot (t, x, ";sine [0:2pi];"); hold on; |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
573 %! plot (-3:3,-3:3, ";line (-3,-3)->(3,3);"); hold off; |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
574 %! title ("manual"); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
575 %! axis ("manual"); |
3667 | 576 %! |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
577 %! subplot (324); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
578 %! plot (t, x, ";sine [0:2pi];"); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
579 %! title ("axes at [0 3 0 1], then autox"); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
580 %! axis ([0,3,0,1]); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
581 %! axis ("autox"); |
3667 | 582 %! |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
583 %! subplot (325); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
584 %! plot (t, x, ";sine [0:2pi];"); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
585 %! title ("axes at [3 6 0 1], then autoy"); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
586 %! axis ([3,6,0,1]); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
587 %! axis ("autoy"); |
3667 | 588 %! |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
589 %! subplot (326); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
590 %! plot (t, sin(t), t, -2*sin(t/2)); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
591 %! axis ("tight"); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
592 %! title ("tight"); |
8953
a6945f92b868
__go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents:
8920
diff
changeset
|
593 |
a6945f92b868
__go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents:
8920
diff
changeset
|
594 %!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
|
595 %! clf; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
596 %! x = 0:0.1:10; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
597 %! plot (x, sin(x)); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
598 %! axis image; |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
599 %! title ({"image", 'equivalent to "tight" & "equal"'}); |
8953
a6945f92b868
__go_draw_axes__.m: Unset the {x,y,z}ticks when initializing\n\teach axis. Set ticklabels when the ticklabels are empty and when\n\tticklabelmode=="manual".
Ben Abbott <bpabbott@mac.com>
parents:
8920
diff
changeset
|
600 |
9357
95ec56601497
axis.m: Fix bug for 'axis tight' with multiple surface plots, add demo.
Ben Abbott <bpabbott@mac.com>
parents:
9317
diff
changeset
|
601 %!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
|
602 %! clf; |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
603 %! colormap ("default"); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
604 %! [x,y,z] = peaks (50); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
605 %! x1 = max (x(:)); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
606 %! pcolor (x-x1, y-x1/2, z); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
607 %! hold on; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
608 %! [x,y,z] = sombrero (); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
609 %! s = x1 / max (x(:)); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
610 %! pcolor (s*x+x1, s*y+x1/2, 5*z); |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
611 %! axis tight; |
24388 | 612 %! title ('"tight" when two axes objects exist'); |
11201
6c8791cb35b1
__go_draw_axes__.m: Set proper tight axis limits for log scale.
Ben Abbott <bpabbott@mac.com>
parents:
11191
diff
changeset
|
613 |
13154 | 614 %!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
|
615 %! clf; |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
616 %! loglog (1:20, "-s"); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
617 %! axis tight; |
24388 | 618 %! title ('"tight" on loglog plot'); |
13322
16a706965ee0
Allow the axis box to be turned off for the gnuplot backend.
Ben Abbott <bpabbott@mac.com>
parents:
13175
diff
changeset
|
619 |
14054
ec79cd8359c5
Ignore Inf when determining tight axis limits.
Ben Abbott <bpabbott@mac.com>
parents:
13322
diff
changeset
|
620 %!test |
ec79cd8359c5
Ignore Inf when determining tight axis limits.
Ben Abbott <bpabbott@mac.com>
parents:
13322
diff
changeset
|
621 %! hf = figure ("visible", "off"); |
ec79cd8359c5
Ignore Inf when determining tight axis limits.
Ben Abbott <bpabbott@mac.com>
parents:
13322
diff
changeset
|
622 %! unwind_protect |
ec79cd8359c5
Ignore Inf when determining tight axis limits.
Ben Abbott <bpabbott@mac.com>
parents:
13322
diff
changeset
|
623 %! plot (11:20, [21:24, NaN, -Inf, 27:30]); |
22069
9121d6584f6a
Overhaul graphics implementation of hold() (bug #43559).
Rik <rik@octave.org>
parents:
21808
diff
changeset
|
624 %! hold on; |
14054
ec79cd8359c5
Ignore Inf when determining tight axis limits.
Ben Abbott <bpabbott@mac.com>
parents:
13322
diff
changeset
|
625 %! plot (11:20, 25.5 + rand (10)); |
ec79cd8359c5
Ignore Inf when determining tight axis limits.
Ben Abbott <bpabbott@mac.com>
parents:
13322
diff
changeset
|
626 %! axis tight; |
14063
6875d23ce051
Fix regression of tight axis limits introduced by changeset ec79cd8359c5.
Ben Abbott <bpabbott@mac.com>
parents:
14054
diff
changeset
|
627 %! assert (axis (), [11 20 21 30]); |
14054
ec79cd8359c5
Ignore Inf when determining tight axis limits.
Ben Abbott <bpabbott@mac.com>
parents:
13322
diff
changeset
|
628 %! unwind_protect_cleanup |
ec79cd8359c5
Ignore Inf when determining tight axis limits.
Ben Abbott <bpabbott@mac.com>
parents:
13322
diff
changeset
|
629 %! close (hf); |
ec79cd8359c5
Ignore Inf when determining tight axis limits.
Ben Abbott <bpabbott@mac.com>
parents:
13322
diff
changeset
|
630 %! end_unwind_protect |
ec79cd8359c5
Ignore Inf when determining tight axis limits.
Ben Abbott <bpabbott@mac.com>
parents:
13322
diff
changeset
|
631 |
14063
6875d23ce051
Fix regression of tight axis limits introduced by changeset ec79cd8359c5.
Ben Abbott <bpabbott@mac.com>
parents:
14054
diff
changeset
|
632 %!test |
6875d23ce051
Fix regression of tight axis limits introduced by changeset ec79cd8359c5.
Ben Abbott <bpabbott@mac.com>
parents:
14054
diff
changeset
|
633 %! hf = figure ("visible", "off"); |
6875d23ce051
Fix regression of tight axis limits introduced by changeset ec79cd8359c5.
Ben Abbott <bpabbott@mac.com>
parents:
14054
diff
changeset
|
634 %! unwind_protect |
6875d23ce051
Fix regression of tight axis limits introduced by changeset ec79cd8359c5.
Ben Abbott <bpabbott@mac.com>
parents:
14054
diff
changeset
|
635 %! a = logspace (-5, 1, 10); |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
636 %! loglog (a, -a); |
14063
6875d23ce051
Fix regression of tight axis limits introduced by changeset ec79cd8359c5.
Ben Abbott <bpabbott@mac.com>
parents:
14054
diff
changeset
|
637 %! axis tight; |
23952
5570b0f12112
Fix BIST for axis.m on Win64 (bug #48364).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23573
diff
changeset
|
638 %! ## Compare to powers of 10 rather than exponential literals because of an |
5570b0f12112
Fix BIST for axis.m on Win64 (bug #48364).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23573
diff
changeset
|
639 %! ## upstream bug in mingw-w64: https://sourceforge.net/p/mingw-w64/bugs/466/ |
5570b0f12112
Fix BIST for axis.m on Win64 (bug #48364).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23573
diff
changeset
|
640 %! assert (axis (), [10^-5, 10, -10, -10^-5]); |
14063
6875d23ce051
Fix regression of tight axis limits introduced by changeset ec79cd8359c5.
Ben Abbott <bpabbott@mac.com>
parents:
14054
diff
changeset
|
641 %! unwind_protect_cleanup |
6875d23ce051
Fix regression of tight axis limits introduced by changeset ec79cd8359c5.
Ben Abbott <bpabbott@mac.com>
parents:
14054
diff
changeset
|
642 %! close (hf); |
6875d23ce051
Fix regression of tight axis limits introduced by changeset ec79cd8359c5.
Ben Abbott <bpabbott@mac.com>
parents:
14054
diff
changeset
|
643 %! end_unwind_protect |
6875d23ce051
Fix regression of tight axis limits introduced by changeset ec79cd8359c5.
Ben Abbott <bpabbott@mac.com>
parents:
14054
diff
changeset
|
644 |
17427
15d592c82abc
test: Add test for bug #40036 to axis.m
Rik <rik@octave.org>
parents:
17426
diff
changeset
|
645 ## Test 'axis tight' with differently oriented, differently numbered data vecs |
23573
1b4f4ec53b4a
use new script to tag fixed bugs in tests
John W. Eaton <jwe@octave.org>
parents:
23572
diff
changeset
|
646 %!test <*40036> |
17427
15d592c82abc
test: Add test for bug #40036 to axis.m
Rik <rik@octave.org>
parents:
17426
diff
changeset
|
647 %! hf = figure ("visible", "off"); |
15d592c82abc
test: Add test for bug #40036 to axis.m
Rik <rik@octave.org>
parents:
17426
diff
changeset
|
648 %! unwind_protect |
15d592c82abc
test: Add test for bug #40036 to axis.m
Rik <rik@octave.org>
parents:
17426
diff
changeset
|
649 %! Z = peaks (linspace (-3, 3, 49), linspace (-2, 2, 29)); |
15d592c82abc
test: Add test for bug #40036 to axis.m
Rik <rik@octave.org>
parents:
17426
diff
changeset
|
650 %! surf (Z); |
15d592c82abc
test: Add test for bug #40036 to axis.m
Rik <rik@octave.org>
parents:
17426
diff
changeset
|
651 %! axis tight; |
15d592c82abc
test: Add test for bug #40036 to axis.m
Rik <rik@octave.org>
parents:
17426
diff
changeset
|
652 %! assert (axis (), [1 49 1 29 min(Z(:)) max(Z(:))]); |
15d592c82abc
test: Add test for bug #40036 to axis.m
Rik <rik@octave.org>
parents:
17426
diff
changeset
|
653 %! unwind_protect_cleanup |
15d592c82abc
test: Add test for bug #40036 to axis.m
Rik <rik@octave.org>
parents:
17426
diff
changeset
|
654 %! close (hf); |
15d592c82abc
test: Add test for bug #40036 to axis.m
Rik <rik@octave.org>
parents:
17426
diff
changeset
|
655 %! end_unwind_protect |
15d592c82abc
test: Add test for bug #40036 to axis.m
Rik <rik@octave.org>
parents:
17426
diff
changeset
|
656 |
22170
20257791e358
avoid displaying plots in axis tests (bug #48602)
John W. Eaton <jwe@octave.org>
parents:
22163
diff
changeset
|
657 ## Even on errors, axis can display a figure. |
22218
6bb0f32d22a5
axis.m: Clean up formatting in %!error tests.
Rik <rik@octave.org>
parents:
22170
diff
changeset
|
658 %!error <LIMITS vector must have .* elements> |
6bb0f32d22a5
axis.m: Clean up formatting in %!error tests.
Rik <rik@octave.org>
parents:
22170
diff
changeset
|
659 %! hf = figure ("visible", "off"); |
22170
20257791e358
avoid displaying plots in axis tests (bug #48602)
John W. Eaton <jwe@octave.org>
parents:
22163
diff
changeset
|
660 %! unwind_protect |
20257791e358
avoid displaying plots in axis tests (bug #48602)
John W. Eaton <jwe@octave.org>
parents:
22163
diff
changeset
|
661 %! axis (1:5) |
20257791e358
avoid displaying plots in axis tests (bug #48602)
John W. Eaton <jwe@octave.org>
parents:
22163
diff
changeset
|
662 %! unwind_protect_cleanup |
20257791e358
avoid displaying plots in axis tests (bug #48602)
John W. Eaton <jwe@octave.org>
parents:
22163
diff
changeset
|
663 %! close (hf); |
20257791e358
avoid displaying plots in axis tests (bug #48602)
John W. Eaton <jwe@octave.org>
parents:
22163
diff
changeset
|
664 %! end_unwind_protect |
20257791e358
avoid displaying plots in axis tests (bug #48602)
John W. Eaton <jwe@octave.org>
parents:
22163
diff
changeset
|
665 |
22819
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
666 %!error <LIMITS\(3\) must be less than LIMITS\(4\)> |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
667 %! hf = figure ("visible", "off"); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
668 %! unwind_protect |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
669 %! axis ([1 2 4 3]) |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
670 %! unwind_protect_cleanup |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
671 %! close (hf); |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
672 %! end_unwind_protect |
3dd91233bf07
axis.m: Overhaul internal function __axis__.
Rik <rik@octave.org>
parents:
22818
diff
changeset
|
673 |
22218
6bb0f32d22a5
axis.m: Clean up formatting in %!error tests.
Rik <rik@octave.org>
parents:
22170
diff
changeset
|
674 %!error <expecting no args, or a numeric vector with .* elements> |
6bb0f32d22a5
axis.m: Clean up formatting in %!error tests.
Rik <rik@octave.org>
parents:
22170
diff
changeset
|
675 %! hf = figure ("visible", "off"); |
22170
20257791e358
avoid displaying plots in axis tests (bug #48602)
John W. Eaton <jwe@octave.org>
parents:
22163
diff
changeset
|
676 %! unwind_protect |
20257791e358
avoid displaying plots in axis tests (bug #48602)
John W. Eaton <jwe@octave.org>
parents:
22163
diff
changeset
|
677 %! axis ({1,2}) |
20257791e358
avoid displaying plots in axis tests (bug #48602)
John W. Eaton <jwe@octave.org>
parents:
22163
diff
changeset
|
678 %! unwind_protect_cleanup |
20257791e358
avoid displaying plots in axis tests (bug #48602)
John W. Eaton <jwe@octave.org>
parents:
22163
diff
changeset
|
679 %! close (hf); |
20257791e358
avoid displaying plots in axis tests (bug #48602)
John W. Eaton <jwe@octave.org>
parents:
22163
diff
changeset
|
680 %! end_unwind_protect |