annotate scripts/plot/axis.m @ 8507:cadc73247d65

style fixes
author John W. Eaton <jwe@octave.org>
date Tue, 13 Jan 2009 14:08:36 -0500
parents 73d6b71788c0
children 85c9906abfd1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7017
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
1 ## Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000, 2002, 2003, 2004,
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
2 ## 2005, 2006, 2007 John W. Eaton
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
3 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
4 ## This file is part of Octave.
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
5 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
6 ## Octave is free software; you can redistribute it and/or modify it
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
7 ## under the terms of the GNU General Public License as published by
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6765
diff changeset
8 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6765
diff changeset
9 ## your option) any later version.
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
10 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
11 ## Octave is distributed in the hope that it will be useful, but
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
14 ## General Public License for more details.
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
15 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
16 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6765
diff changeset
17 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6765
diff changeset
18 ## <http://www.gnu.org/licenses/>.
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
19
3368
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 3106
diff changeset
20 ## -*- texinfo -*-
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 3106
diff changeset
21 ## @deftypefn {Function File} {} axis (@var{limits})
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
22 ## Set axis limits for plots.
3426
f8dde1807dee [project @ 2000-01-13 08:40:00 by jwe]
jwe
parents: 3368
diff changeset
23 ##
3368
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 3106
diff changeset
24 ## The argument @var{limits} should be a 2, 4, or 6 element vector. The
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 3106
diff changeset
25 ## first and second elements specify the lower and upper limits for the x
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 3106
diff changeset
26 ## axis. The third and fourth specify the limits for the y axis, and the
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 3106
diff changeset
27 ## fifth and sixth specify the limits for the z axis.
3426
f8dde1807dee [project @ 2000-01-13 08:40:00 by jwe]
jwe
parents: 3368
diff changeset
28 ##
4945
4bd917f8a4a7 [project @ 2004-08-31 15:09:17 by jwe]
jwe
parents: 4340
diff changeset
29 ## Without any arguments, @code{axis} turns autoscaling on.
4bd917f8a4a7 [project @ 2004-08-31 15:09:17 by jwe]
jwe
parents: 4340
diff changeset
30 ##
8507
cadc73247d65 style fixes
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
31 ## With one output argument, @code{x = axis} returns the current axes
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
32 ##
3668
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
33 ## The vector argument specifying limits is optional, and additional
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
34 ## string arguments may be used to specify various axis properties. For
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
35 ## example,
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
36 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
37 ## @example
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
38 ## axis ([1, 2, 3, 4], "square");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
39 ## @end example
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
40 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
41 ## @noindent
3668
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
42 ## forces a square aspect ratio, and
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
43 ##
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
44 ## @example
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
45 ## axis ("labely", "tic");
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
46 ## @end example
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
47 ##
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
48 ## @noindent
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
49 ## turns tic marks on for all axes and tic mark labels on for the y-axis
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
50 ## only.
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
51 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
52 ## @noindent
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
53 ## The following options control the aspect ratio of the axes.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
54 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
55 ## @table @code
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
56 ## @item "square"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
57 ## Force a square aspect ratio.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
58 ## @item "equal"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
59 ## Force x distance to equal y-distance.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
60 ## @item "normal"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
61 ## Restore the balance.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
62 ## @end table
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
63 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
64 ## @noindent
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
65 ## The following options control the way axis limits are interpreted.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
66 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
67 ## @table @code
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
68 ## @item "auto"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
69 ## Set the specified axes to have nice limits around the data
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
70 ## or all if no axes are specified.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
71 ## @item "manual"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
72 ## Fix the current axes limits.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
73 ## @item "tight"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
74 ## Fix axes to the limits of the data (not implemented).
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
75 ## @end table
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
76 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
77 ## @noindent
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
78 ## The option @code{"image"} is equivalent to @code{"tight"} and
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
79 ## @code{"equal"}.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
80 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
81 ## @noindent
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
82 ## The following options affect the appearance of tic marks.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
83 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
84 ## @table @code
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
85 ## @item "on"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
86 ## Turn tic marks and labels on for all axes.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
87 ## @item "off"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
88 ## Turn tic marks off for all axes.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
89 ## @item "tic[xyz]"
3668
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
90 ## Turn tic marks on for all axes, or turn them on for the
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
91 ## specified axes and off for the remainder.
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
92 ## @item "label[xyz]"
3668
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
93 ## Turn tic labels on for all axes, or turn them on for the
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
94 ## specified axes and off for the remainder.
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
95 ## @item "nolabel"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
96 ## Turn tic labels off for all axes.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
97 ## @end table
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
98 ## Note, if there are no tic marks for an axis, there can be no labels.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
99 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
100 ## @noindent
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
101 ## The following options affect the direction of increasing values on
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
102 ## the axes.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
103 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
104 ## @table @code
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
105 ## @item "ij"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
106 ## Reverse y-axis, so lower values are nearer the top.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
107 ## @item "xy"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
108 ## Restore y-axis, so higher values are nearer the top.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
109 ## @end table
4945
4bd917f8a4a7 [project @ 2004-08-31 15:09:17 by jwe]
jwe
parents: 4340
diff changeset
110 ##
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
111 ## If an axes handle is passed as the first argument, then operate on
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
112 ## this axes rather than the current axes.
3368
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 3106
diff changeset
113 ## @end deftypefn
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
114
2314
949ab8eba8bc [project @ 1996-07-12 03:58:02 by jwe]
jwe
parents: 2313
diff changeset
115 ## Author: jwe
949ab8eba8bc [project @ 1996-07-12 03:58:02 by jwe]
jwe
parents: 2313
diff changeset
116
5561
bdd6e60e54fb [project @ 2005-12-05 17:51:17 by jwe]
jwe
parents: 5560
diff changeset
117 ## PKG_ADD: mark_as_command axis
5560
3c668f44c55a [project @ 2005-12-05 17:46:37 by jwe]
jwe
parents: 5545
diff changeset
118
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
119 function varargout = axis (varargin)
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
120
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7189
diff changeset
121 [h, varargin, nargin] = __plt_get_axis_arg__ ("axis", varargin{:});
7216
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7215
diff changeset
122
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7189
diff changeset
123 oldh = gca ();
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7189
diff changeset
124 unwind_protect
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7189
diff changeset
125 axes (h);
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
126 varargout = cell (max (nargin == 0, nargout), 1);
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
127 if (isempty (varargout))
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7189
diff changeset
128 __axis__ (h, varargin{:});
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
129 else
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7189
diff changeset
130 [varargout{:}] = __axis__ (h, varargin{:});
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
131 endif
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7189
diff changeset
132 unwind_protect_cleanup
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7189
diff changeset
133 axes (oldh);
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7189
diff changeset
134 end_unwind_protect
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
135
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
136 endfunction
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
137
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
138 function curr_axis = __axis__ (ca, ax, varargin)
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
139
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
140 if (nargin == 1)
4945
4bd917f8a4a7 [project @ 2004-08-31 15:09:17 by jwe]
jwe
parents: 4340
diff changeset
141 if (nargout == 0)
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
142 set (ca, "xlimmode", "auto", "ylimmode", "auto", "zlimmode", "auto");
4945
4bd917f8a4a7 [project @ 2004-08-31 15:09:17 by jwe]
jwe
parents: 4340
diff changeset
143 else
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
144 xlim = get (ca, "xlim");
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
145 ylim = get (ca, "ylim");
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
146 zlim = get (ca, "zlim");
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
147 curr_axis = [xlim, ylim, zlim];
4945
4bd917f8a4a7 [project @ 2004-08-31 15:09:17 by jwe]
jwe
parents: 4340
diff changeset
148 endif
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
149
5443
ec8c33dcd1bf [project @ 2005-09-08 01:40:57 by jwe]
jwe
parents: 5307
diff changeset
150 elseif (ischar (ax))
4340
8aa604426d35 [project @ 2003-02-20 04:01:31 by jwe]
jwe
parents: 4259
diff changeset
151 len = length (ax);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
152
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
153 ## 'matrix mode' to reverse the y-axis
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7994
diff changeset
154 if (strcmpi (ax, "ij"))
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
155 set (ca, "ydir", "reverse");
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7994
diff changeset
156 elseif (strcmpi (ax, "xy"))
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
157 set (ca, "ydir", "normal");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
158
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
159 ## aspect ratio
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7994
diff changeset
160 elseif (strcmpi (ax, "image"))
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
161 set (ca, "dataaspectratio", [1, 1, 1]);
7376
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
162 __do_tight_option__ (ca);
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7994
diff changeset
163 elseif (strcmpi (ax, "equal") || strcmpi (ax, "square"))
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
164 set (ca, "dataaspectratio", [1, 1, 1]);
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7994
diff changeset
165 elseif (strcmpi (ax, "normal"))
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
166 set (ca, "dataaspectratiomode", "auto");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
167
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
168 ## axis limits
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7994
diff changeset
169 elseif (len >= 4 && strcmpi (ax(1:4), "auto"))
4340
8aa604426d35 [project @ 2003-02-20 04:01:31 by jwe]
jwe
parents: 4259
diff changeset
170 if (len > 4)
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
171 if (any (ax == "x"))
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
172 set (ca, "xlimmode", "auto");
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
173 endif
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
174 if (any (ax == "y"))
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
175 set (ca, "ylimmode", "auto");
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
176 endif
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
177 if (any (ax == "z"))
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
178 set (ca, "zlimmode", "auto");
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
179 endif
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
180 else
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
181 set (ca, "xlimmode", "auto", "ylimmode", "auto", "zlimmode", "auto");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
182 endif
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7994
diff changeset
183 elseif (strcmpi (ax, "manual"))
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
184 ## fixes the axis limits, like axis(axis) should;
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
185 set (ca, "xlimmode", "manual", "ylimmode", "manual", "zlimmode", "manual");
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7994
diff changeset
186 elseif (strcmpi (ax, "tight"))
7376
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
187 ## sets the axis limits to the min and max of all data.
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
188 __do_tight_option__ (ca);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
189
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
190 ## tic marks
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7994
diff changeset
191 elseif (strcmpi (ax, "on") || strcmpi (ax, "tic"))
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
192 set (ca, "xtickmode", "auto", "ytickmode", "auto", "ztickmode", "auto");
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
193 set (ca, "xticklabelmode", "auto", "yticklabelmode", "auto",
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
194 "zticklabelmode", "auto");
6765
e6b528a3a2a9 [project @ 2007-06-28 15:25:43 by jwe]
jwe
parents: 6746
diff changeset
195 set (ca, "visible", "on");
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7994
diff changeset
196 elseif (strcmpi (ax, "off"))
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
197 set (ca, "xtick", [], "ytick", [], "ztick", []);
6765
e6b528a3a2a9 [project @ 2007-06-28 15:25:43 by jwe]
jwe
parents: 6746
diff changeset
198 set (ca, "visible", "off");
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7994
diff changeset
199 elseif (len > 3 && strcmpi (ax(1:3), "tic"))
4340
8aa604426d35 [project @ 2003-02-20 04:01:31 by jwe]
jwe
parents: 4259
diff changeset
200 if (any (ax == "x"))
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
201 set (ca, "xtickmode", "auto");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
202 else
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
203 set (ca, "xtick", []);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
204 endif
4340
8aa604426d35 [project @ 2003-02-20 04:01:31 by jwe]
jwe
parents: 4259
diff changeset
205 if (any (ax == "y"))
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
206 set (ca, "ytickmode", "auto");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
207 else
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
208 set (ca, "ytick", []);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
209 endif
4340
8aa604426d35 [project @ 2003-02-20 04:01:31 by jwe]
jwe
parents: 4259
diff changeset
210 if (any (ax == "z"))
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
211 set (ca, "ztickmode", "auto");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
212 else
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
213 set (ca, "ztick", []);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
214 endif
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7994
diff changeset
215 elseif (strcmpi (ax, "label"))
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
216 set (ca, "xticklabelmode", "auto", "yticklabelmode", "auto",
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
217 "zticklabelmode", "auto");
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7994
diff changeset
218 elseif (strcmpi (ax, "nolabel"))
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
219 set (ca, "xticklabel", "", "yticklabel", "", "zticklabel", "");
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7994
diff changeset
220 elseif (len > 5 && strcmpi (ax(1:5), "label"))
4340
8aa604426d35 [project @ 2003-02-20 04:01:31 by jwe]
jwe
parents: 4259
diff changeset
221 if (any (ax == "x"))
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
222 set (ca, "xticklabelmode", "auto");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
223 else
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
224 set (ca, "xticklabel", "");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
225 endif
4340
8aa604426d35 [project @ 2003-02-20 04:01:31 by jwe]
jwe
parents: 4259
diff changeset
226 if (any (ax == "y"))
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
227 set (ca, "yticklabelmode", "auto");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
228 else
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
229 set (ca, "yticklabel", "");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
230 endif
4340
8aa604426d35 [project @ 2003-02-20 04:01:31 by jwe]
jwe
parents: 4259
diff changeset
231 if (any (ax == "z"))
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
232 set (ca, "zticklabelmode", "auto");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
233 else
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
234 set (ca, "zticklabel", "");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
235 endif
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
236
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
237 else
4259
0493a367de6f [project @ 2003-01-02 17:30:14 by jwe]
jwe
parents: 4030
diff changeset
238 warning ("unknown axis option '%s'", ax);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
239 endif
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
240
4030
22bd65326ec1 [project @ 2002-08-09 18:58:13 by jwe]
jwe
parents: 3979
diff changeset
241 elseif (isvector (ax))
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
242
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
243 len = length (ax);
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
244
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
245 if (len != 2 && len != 4 && len != 6)
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
246 error ("axis: expecting vector with 2, 4, or 6 elements");
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
247 endif
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
248
5627
0f6a0a85a857 [project @ 2006-02-16 20:13:35 by jwe]
jwe
parents: 5561
diff changeset
249 for i = 1:2:len
0f6a0a85a857 [project @ 2006-02-16 20:13:35 by jwe]
jwe
parents: 5561
diff changeset
250 if (ax(i) == ax(i+1))
0f6a0a85a857 [project @ 2006-02-16 20:13:35 by jwe]
jwe
parents: 5561
diff changeset
251 error ("axis: limits(%d) cannot equal limits(%d)", i, i+1);
0f6a0a85a857 [project @ 2006-02-16 20:13:35 by jwe]
jwe
parents: 5561
diff changeset
252 endif
0f6a0a85a857 [project @ 2006-02-16 20:13:35 by jwe]
jwe
parents: 5561
diff changeset
253 endfor
0f6a0a85a857 [project @ 2006-02-16 20:13:35 by jwe]
jwe
parents: 5561
diff changeset
254
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
255 if (len > 1)
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
256 set (ca, "xlim", [ax(1), ax(2)]);
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
257 endif
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
258
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
259 if (len > 3)
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
260 set (ca, "ylim", [ax(3), ax(4)]);
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
261 endif
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
262
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
263 if (len > 5)
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 5775
diff changeset
264 set (ca, "zlim", [ax(5), ax(6)]);
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
265 endif
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
266
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
267 else
595
a0cc17145462 [project @ 1994-08-09 18:42:23 by jwe]
jwe
parents: 594
diff changeset
268 error ("axis: expecting no args, or a vector with 2, 4, or 6 elements");
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
269 endif
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
270
7376
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
271 if (! isempty (varargin))
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7017
diff changeset
272 __axis__ (ca, varargin{:});
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
273 endif
6447
3f79532415b5 [project @ 2007-03-24 00:00:31 by jwe]
jwe
parents: 6257
diff changeset
274
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
275 endfunction
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
276
7376
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
277 function lims = __get_tight_lims__ (ca, ax)
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
278
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
279 ## Get the limits for axis ("tight").
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
280 ## AX should be one of "x", "y", or "z".
7994
8ccd9b0bf6bc plot/axis.m (__get_tight_lims__): don't fail if data is not a vector
John W. Eaton <jwe@octave.org>
parents: 7376
diff changeset
281 kids = findobj (ca, "-property", strcat (ax, "data"));
7376
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
282 if (isempty (kids))
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
283 ## Return the current limits.
7994
8ccd9b0bf6bc plot/axis.m (__get_tight_lims__): don't fail if data is not a vector
John W. Eaton <jwe@octave.org>
parents: 7376
diff changeset
284 lims = get (ca, strcat (ax, "lim"));
7376
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
285 else
7994
8ccd9b0bf6bc plot/axis.m (__get_tight_lims__): don't fail if data is not a vector
John W. Eaton <jwe@octave.org>
parents: 7376
diff changeset
286 data = get (kids, strcat (ax, "data"));
7376
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
287 if (iscell (data))
7994
8ccd9b0bf6bc plot/axis.m (__get_tight_lims__): don't fail if data is not a vector
John W. Eaton <jwe@octave.org>
parents: 7376
diff changeset
288 lims(1) = min (cellfun (@min, data)(:));
8ccd9b0bf6bc plot/axis.m (__get_tight_lims__): don't fail if data is not a vector
John W. Eaton <jwe@octave.org>
parents: 7376
diff changeset
289 lims(2) = min (cellfun (@max, data)(:));
7376
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
290 else
7994
8ccd9b0bf6bc plot/axis.m (__get_tight_lims__): don't fail if data is not a vector
John W. Eaton <jwe@octave.org>
parents: 7376
diff changeset
291 lims = [min(data(:)), max(data(:))];
7376
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
292 end
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
293 end
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
294
7994
8ccd9b0bf6bc plot/axis.m (__get_tight_lims__): don't fail if data is not a vector
John W. Eaton <jwe@octave.org>
parents: 7376
diff changeset
295
7376
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
296 endfunction
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
297
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
298 function __do_tight_option__ (ca)
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
299
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
300 set (ca,
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
301 "xlim", __get_tight_lims__ (ca, "x"),
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
302 "ylim", __get_tight_lims__ (ca, "y"),
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
303 "zlim", __get_tight_lims__ (ca, "z"));
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
304
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
305 endfunction
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
306
b052b844e094 [project @ 2008-01-15 01:18:39 by jwe]
jwe
parents: 7216
diff changeset
307
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
308 %!demo
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
309 %! t=0:0.01:2*pi; x=sin(t);
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
310 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
311 %! subplot(221); title("normal plot");
6746
a8105a726e68 [project @ 2007-06-19 08:18:34 by dbateman]
dbateman
parents: 6447
diff changeset
312 %! plot(t, x);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
313 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
314 %! subplot(222); title("square plot");
6746
a8105a726e68 [project @ 2007-06-19 08:18:34 by dbateman]
dbateman
parents: 6447
diff changeset
315 %! axis("square"); plot(t, x);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
316 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
317 %! subplot(223); title("equal plot");
6746
a8105a726e68 [project @ 2007-06-19 08:18:34 by dbateman]
dbateman
parents: 6447
diff changeset
318 %! axis("equal"); plot(t, x);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
319 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
320 %! subplot(224); title("normal plot again");
6746
a8105a726e68 [project @ 2007-06-19 08:18:34 by dbateman]
dbateman
parents: 6447
diff changeset
321 %! axis("normal"); plot(t, x);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
322
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
323 %!demo
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
324 %! t=0:0.01:2*pi; x=sin(t);
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
325 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
326 %! subplot(121); title("ij plot");
6746
a8105a726e68 [project @ 2007-06-19 08:18:34 by dbateman]
dbateman
parents: 6447
diff changeset
327 %! axis("ij"); plot(t, x);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
328 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
329 %! subplot(122); title("xy plot");
6746
a8105a726e68 [project @ 2007-06-19 08:18:34 by dbateman]
dbateman
parents: 6447
diff changeset
330 %! axis("xy"); plot(t, x);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
331
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
332 %!demo
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
333 %! t=0:0.01:2*pi; x=sin(t);
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
334 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
335 %! subplot(331); title("x tics & labels");
6746
a8105a726e68 [project @ 2007-06-19 08:18:34 by dbateman]
dbateman
parents: 6447
diff changeset
336 %! axis("ticx"); plot(t, x);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
337 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
338 %! subplot(332); title("y tics & labels");
6746
a8105a726e68 [project @ 2007-06-19 08:18:34 by dbateman]
dbateman
parents: 6447
diff changeset
339 %! axis("ticy"); plot(t, x);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
340 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
341 %! subplot(334); title("x & y tics, x labels");
6746
a8105a726e68 [project @ 2007-06-19 08:18:34 by dbateman]
dbateman
parents: 6447
diff changeset
342 %! axis("labelx","tic"); plot(t, x);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
343 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
344 %! subplot(335); title("x & y tics, y labels");
6746
a8105a726e68 [project @ 2007-06-19 08:18:34 by dbateman]
dbateman
parents: 6447
diff changeset
345 %! axis("labely","tic"); plot(t, x);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
346 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
347 %! subplot(337); title("x tics, no labels");
6746
a8105a726e68 [project @ 2007-06-19 08:18:34 by dbateman]
dbateman
parents: 6447
diff changeset
348 %! axis("nolabel","ticx"); plot(t, x);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
349 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
350 %! subplot(338); title("y tics, no labels");
6746
a8105a726e68 [project @ 2007-06-19 08:18:34 by dbateman]
dbateman
parents: 6447
diff changeset
351 %! axis("nolabel","ticy"); plot(t, x);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
352 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
353 %! subplot(333); title("no tics or labels");
6746
a8105a726e68 [project @ 2007-06-19 08:18:34 by dbateman]
dbateman
parents: 6447
diff changeset
354 %! axis("off"); plot(t, x);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
355 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
356 %! subplot(336); title("all tics but no labels");
6746
a8105a726e68 [project @ 2007-06-19 08:18:34 by dbateman]
dbateman
parents: 6447
diff changeset
357 %! axis("nolabel","tic"); plot(t, x);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
358 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
359 %! subplot(339); title("all tics & labels");
6746
a8105a726e68 [project @ 2007-06-19 08:18:34 by dbateman]
dbateman
parents: 6447
diff changeset
360 %! axis("on"); plot(t, x);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
361
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
362 %!demo
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
363 %! t=0:0.01:2*pi; x=sin(t);
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
364 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
365 %! subplot(321); title("axes at [0 3 0 1]")
6746
a8105a726e68 [project @ 2007-06-19 08:18:34 by dbateman]
dbateman
parents: 6447
diff changeset
366 %! axis([0,3,0,1]); plot(t, x);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
367 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
368 %! subplot(322); title("auto");
6746
a8105a726e68 [project @ 2007-06-19 08:18:34 by dbateman]
dbateman
parents: 6447
diff changeset
369 %! axis("auto"); plot(t, x);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
370 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
371 %! subplot(323); title("manual");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
372 %! plot(t, x, ";sine [0:2pi];"); hold on;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
373 %! axis("manual");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
374 %! plot(-3:3,-3:3, ";line (-3,-3)->(3,3);"); hold off;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
375 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
376 %! subplot(324); title("axes at [0 3 0 1], then autox");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
377 %! axis([0,3,0,1]); axis("autox");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
378 %! plot(t, x, ";sine [0:2pi];");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
379 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
380 %! subplot(325); title("axes at [3 6 0 1], then autoy");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
381 %! axis([3,6,0,1]); axis("autoy");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
382 %! plot(t, x, ";sine [0:2p];");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
383 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
384 %! subplot(326); title("tight");
6746
a8105a726e68 [project @ 2007-06-19 08:18:34 by dbateman]
dbateman
parents: 6447
diff changeset
385 %! axis("tight"); plot(t, x);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
386 %! % The last plot should not have any whitespace outside the data
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
387 %! % limits, but "tight" isn't implemented yet.