annotate scripts/plot/axis.m @ 5775:ace8d8d26933

[project @ 2006-04-24 19:13:06 by jwe]
author jwe
date Mon, 24 Apr 2006 19:13:11 +0000
parents 0f6a0a85a857
children 44c91c5dfe1d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2847
8b262e771614 [project @ 1997-03-27 16:18:26 by jwe]
jwe
parents: 2520
diff changeset
1 ## Copyright (C) 1996, 1997 John W. Eaton
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
2 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
3 ## This file is part of Octave.
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
4 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
5 ## 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
6 ## under the terms of the GNU General Public License as published by
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
7 ## the Free Software Foundation; either version 2, or (at your option)
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
8 ## any later version.
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
9 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
10 ## 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
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
12 ## 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
13 ## General Public License for more details.
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
14 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
15 ## You should have received a copy of the GNU General Public License
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
16 ## along with Octave; see the file COPYING. If not, write to the Free
5307
4c8a2e4e0717 [project @ 2005-04-26 19:24:27 by jwe]
jwe
parents: 5253
diff changeset
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
4c8a2e4e0717 [project @ 2005-04-26 19:24:27 by jwe]
jwe
parents: 5253
diff changeset
18 ## 02110-1301, USA.
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 ##
4bd917f8a4a7 [project @ 2004-08-31 15:09:17 by jwe]
jwe
parents: 4340
diff changeset
31 ## With one output argument, @code{x=axis} returns the current axes
4bd917f8a4a7 [project @ 2004-08-31 15:09:17 by jwe]
jwe
parents: 4340
diff changeset
32 ## (this is not yet implemented for automatic axes).
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
33 ##
3668
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
34 ## The vector argument specifying limits is optional, and additional
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
35 ## 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
36 ## example,
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
37 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
38 ## @example
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
39 ## axis ([1, 2, 3, 4], "square");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
40 ## @end example
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
41 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
42 ## @noindent
3668
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
43 ## forces a square aspect ratio, and
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
44 ##
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
45 ## @example
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
46 ## axis ("labely", "tic");
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
47 ## @end example
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
48 ##
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
49 ## @noindent
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
50 ## 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
51 ## only.
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
52 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
53 ## @noindent
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
54 ## 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
55 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
56 ## @table @code
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
57 ## @item "square"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
58 ## Force a square aspect ratio.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
59 ## @item "equal"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
60 ## Force x distance to equal y-distance.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
61 ## @item "normal"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
62 ## Restore the balance.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
63 ## @end table
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
64 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
65 ## @noindent
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
66 ## 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
67 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
68 ## @table @code
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
69 ## @item "auto"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
70 ## 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
71 ## or all if no axes are specified.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
72 ## @item "manual"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
73 ## Fix the current axes limits.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
74 ## @item "tight"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
75 ## 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
76 ## @end table
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
77 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
78 ## @noindent
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
79 ## 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
80 ## @code{"equal"}.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
81 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
82 ## @noindent
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
83 ## The following options affect the appearance of tic marks.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
84 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
85 ## @table @code
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
86 ## @item "on"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
87 ## Turn tic marks and labels on for all axes.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
88 ## @item "off"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
89 ## Turn tic marks off for all axes.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
90 ## @item "tic[xyz]"
3668
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
91 ## 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
92 ## specified axes and off for the remainder.
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
93 ## @item "label[xyz]"
3668
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
94 ## 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
95 ## specified axes and off for the remainder.
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
96 ## @item "nolabel"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
97 ## Turn tic labels off for all axes.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
98 ## @end table
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
99 ## 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
100 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
101 ## @noindent
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
102 ## 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
103 ## the axes.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
104 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
105 ## @table @code
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
106 ## @item "ij"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
107 ## 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
108 ## @item "xy"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
109 ## 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
110 ## @end table
4945
4bd917f8a4a7 [project @ 2004-08-31 15:09:17 by jwe]
jwe
parents: 4340
diff changeset
111 ##
3368
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 3106
diff changeset
112 ## @end deftypefn
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
113
2314
949ab8eba8bc [project @ 1996-07-12 03:58:02 by jwe]
jwe
parents: 2313
diff changeset
114 ## Author: jwe
949ab8eba8bc [project @ 1996-07-12 03:58:02 by jwe]
jwe
parents: 2313
diff changeset
115
5561
bdd6e60e54fb [project @ 2005-12-05 17:51:17 by jwe]
jwe
parents: 5560
diff changeset
116 ## PKG_ADD: mark_as_command axis
5560
3c668f44c55a [project @ 2005-12-05 17:46:37 by jwe]
jwe
parents: 5545
diff changeset
117
3979
e0b7a493e5a8 [project @ 2002-07-10 17:45:34 by jwe]
jwe
parents: 3668
diff changeset
118 function curr_axis = axis (ax, varargin)
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
119
2303
5cffc4b8de57 [project @ 1996-06-24 09:15:24 by jwe]
jwe
parents: 1887
diff changeset
120 ## This may not be correct if someone has used the gnuplot interface
5cffc4b8de57 [project @ 1996-06-24 09:15:24 by jwe]
jwe
parents: 1887
diff changeset
121 ## directly...
1610
26a096727e89 [project @ 1995-11-03 05:57:27 by jwe]
jwe
parents: 1315
diff changeset
122
3106
21208b797332 [project @ 1997-11-19 06:26:03 by jwe]
jwe
parents: 2847
diff changeset
123 global __current_axis__ = [-10, 10, -10, 10];
1610
26a096727e89 [project @ 1995-11-03 05:57:27 by jwe]
jwe
parents: 1315
diff changeset
124
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
125 ## To return curr_axis properly, octave needs to take control of scaling.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
126 ## It isn't hard to compute good axis limits:
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
127 ## scale = 10 ^ floor (log10 (max - min) - 1);
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
128 ## r = scale * [floor (min / scale), ceil (max / scale)];
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
129 ## However, with axis("manual") there is little need to know the current
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
130 ## limits.
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
131
595
a0cc17145462 [project @ 1994-08-09 18:42:23 by jwe]
jwe
parents: 594
diff changeset
132 if (nargin == 0)
4945
4bd917f8a4a7 [project @ 2004-08-31 15:09:17 by jwe]
jwe
parents: 4340
diff changeset
133 if (nargout == 0)
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
134 __gnuplot_raw__ ("set autoscale;\n");
4945
4bd917f8a4a7 [project @ 2004-08-31 15:09:17 by jwe]
jwe
parents: 4340
diff changeset
135 else
4bd917f8a4a7 [project @ 2004-08-31 15:09:17 by jwe]
jwe
parents: 4340
diff changeset
136 curr_axis = __current_axis__;
4bd917f8a4a7 [project @ 2004-08-31 15:09:17 by jwe]
jwe
parents: 4340
diff changeset
137 endif
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
138
5443
ec8c33dcd1bf [project @ 2005-09-08 01:40:57 by jwe]
jwe
parents: 5307
diff changeset
139 elseif (ischar (ax))
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
140 ax = tolower (ax);
4340
8aa604426d35 [project @ 2003-02-20 04:01:31 by jwe]
jwe
parents: 4259
diff changeset
141 len = length (ax);
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
142
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
143 ## 'matrix mode' to reverse the y-axis
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
144 if (strcmp (ax, "ij"))
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
145 __gnuplot_raw__ ("set yrange [] reverse;\n");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
146 elseif (strcmp (ax, "xy"))
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
147 __gnuplot_raw__ ("set yrange [] noreverse;\n");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
148
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
149 ## aspect ratio
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
150 elseif (strcmp (ax, "image"))
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
151 __gnuplot_raw__ ("set size ratio -1;\n");
5775
ace8d8d26933 [project @ 2006-04-24 19:13:06 by jwe]
jwe
parents: 5627
diff changeset
152 __gnuplot_raw__ ("set autoscale;\n"); ## FIXME should be the same as "tight"
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
153 elseif (strcmp (ax, "equal"))
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
154 __gnuplot_raw__ ("set size ratio -1;\n");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
155 elseif (strcmp (ax, "square"))
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
156 __gnuplot_raw__ ("set size ratio 1;\n");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
157 elseif (strcmp (ax, "normal"))
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
158 __gnuplot_raw__ ("set size noratio;\n");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
159
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
160
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
161 ## axis limits
4340
8aa604426d35 [project @ 2003-02-20 04:01:31 by jwe]
jwe
parents: 4259
diff changeset
162 elseif (len >= 4 && strcmp (ax(1:4), "auto"))
8aa604426d35 [project @ 2003-02-20 04:01:31 by jwe]
jwe
parents: 4259
diff changeset
163 if (len > 4)
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
164 __gnuplot_raw__ (sprintf ("set autoscale %s;\n", ax(5:len)));
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
165 else
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
166 __gnuplot_raw__ ("set autoscale;\n");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
167 endif
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
168 elseif (strcmp (ax, "manual"))
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
169 ## fixes the axis limits, like axis(axis) should;
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
170 __gnuplot_raw__ ("set xrange [] writeback;\n");
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
171 __gnuplot_raw__ ("set yrange [] writeback;\n");
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
172 __gnuplot_raw__ ("set zrange [] writeback;\n");
5775
ace8d8d26933 [project @ 2006-04-24 19:13:06 by jwe]
jwe
parents: 5627
diff changeset
173 ## FIXME if writeback were set in plot, no need to replot here.
5253
6b91c98e3db0 [project @ 2005-03-28 18:56:56 by jwe]
jwe
parents: 5252
diff changeset
174 ## No semicolon (see replot.m).
5493
b2e882e8b68b [project @ 2005-10-13 17:51:19 by jwe]
jwe
parents: 5443
diff changeset
175 replot ();
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
176 __gnuplot_raw__ ("set noautoscale x;\n");
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
177 __gnuplot_raw__ ("set noautoscale y;\n");
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
178 __gnuplot_raw__ ("set noautoscale z;\n");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
179 elseif (strcmp (ax, "tight"))
5775
ace8d8d26933 [project @ 2006-04-24 19:13:06 by jwe]
jwe
parents: 5627
diff changeset
180 ## FIXME if tight, plot must set ranges to limits of the
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
181 ## all the data on the current plot, even if from a previous call.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
182 ## Instead, just let gnuplot do as it likes.
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
183 __gnuplot_raw__ ("set autoscale;\n");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
184
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
185
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
186 ## tic marks
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
187 elseif (strcmp (ax, "on"))
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
188 __gnuplot_raw__ ("set xtics;\n");
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
189 __gnuplot_raw__ ("set ytics;\n");
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
190 __gnuplot_raw__ ("set ztics;\n");
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
191 __gnuplot_raw__ ("set format;\n");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
192 elseif (strcmp (ax, "off"))
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
193 __gnuplot_raw__ ("set noxtics;\n");
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
194 __gnuplot_raw__ ("set noytics;\n");
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
195 __gnuplot_raw__ ("set noztics;\n");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
196 elseif (strcmp (ax, "tic"))
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
197 __gnuplot_raw__ ("set xtics;\n");
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
198 __gnuplot_raw__ ("set ytics;\n");
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
199 __gnuplot_raw__ ("set ztics;\n");
4340
8aa604426d35 [project @ 2003-02-20 04:01:31 by jwe]
jwe
parents: 4259
diff changeset
200 elseif (len > 3 && strcmp (ax(1:3), "tic"))
8aa604426d35 [project @ 2003-02-20 04:01:31 by jwe]
jwe
parents: 4259
diff changeset
201 if (any (ax == "x"))
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
202 __gnuplot_raw__ ("set xtics;\n");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
203 else
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
204 __gnuplot_raw__ ("set noxtics;\n");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
205 endif
4340
8aa604426d35 [project @ 2003-02-20 04:01:31 by jwe]
jwe
parents: 4259
diff changeset
206 if (any (ax == "y"))
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
207 __gnuplot_raw__ ("set ytics;\n");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
208 else
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
209 __gnuplot_raw__ ("set noytics;\n");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
210 endif
4340
8aa604426d35 [project @ 2003-02-20 04:01:31 by jwe]
jwe
parents: 4259
diff changeset
211 if (any (ax == "z"))
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
212 __gnuplot_raw__ ("set ztics;\n");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
213 else
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
214 __gnuplot_raw__ ("set noztics;\n");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
215 endif
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
216 elseif (strcmp (ax, "label"))
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
217 __gnuplot_raw__ ("set format;\n");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
218 elseif (strcmp (ax, "nolabel"))
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
219 __gnuplot_raw__ ("set format \"\\0\";\n");
4340
8aa604426d35 [project @ 2003-02-20 04:01:31 by jwe]
jwe
parents: 4259
diff changeset
220 elseif (len > 5 && strcmp (ax(1:5), "label"))
8aa604426d35 [project @ 2003-02-20 04:01:31 by jwe]
jwe
parents: 4259
diff changeset
221 if (any (ax == "x"))
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
222 __gnuplot_raw__ ("set format x;\n");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
223 else
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
224 __gnuplot_raw__ ("set format x \"\\0\";\n");
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"))
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
227 __gnuplot_raw__ ("set format y;\n");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
228 else
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
229 __gnuplot_raw__ ("set format y \"\\0\";\n");
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"))
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
232 __gnuplot_raw__ ("set format z;\n");
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
233 else
5252
3d9afb170a39 [project @ 2005-03-28 18:40:35 by jwe]
jwe
parents: 5215
diff changeset
234 __gnuplot_raw__ ("set format z \"\\0\";\n");
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
1610
26a096727e89 [project @ 1995-11-03 05:57:27 by jwe]
jwe
parents: 1315
diff changeset
255 __current_axis__ = reshape (ax, 1, len);
26a096727e89 [project @ 1995-11-03 05:57:27 by jwe]
jwe
parents: 1315
diff changeset
256
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
257 if (len > 1)
5545
c4500e72f503 [project @ 2005-11-23 03:55:08 by jwe]
jwe
parents: 5493
diff changeset
258 __gnuplot_raw__ (sprintf ("set xrange [%.16g:%.16g];\n", ax(1), ax(2)));
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
259 endif
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
260
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
261 if (len > 3)
5545
c4500e72f503 [project @ 2005-11-23 03:55:08 by jwe]
jwe
parents: 5493
diff changeset
262 __gnuplot_raw__ (sprintf ("set yrange [%.16g:%.16g];\n", ax(3), ax(4)));
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
263 endif
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
264
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
265 if (len > 5)
5545
c4500e72f503 [project @ 2005-11-23 03:55:08 by jwe]
jwe
parents: 5493
diff changeset
266 __gnuplot_raw__ (sprintf ("set zrange [%.16g:%.16g];\n", ax(5), ax(6)));
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
267 endif
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
268
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
269 else
595
a0cc17145462 [project @ 1994-08-09 18:42:23 by jwe]
jwe
parents: 594
diff changeset
270 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
271 endif
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
272
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
273 if (nargin > 1)
3979
e0b7a493e5a8 [project @ 2002-07-10 17:45:34 by jwe]
jwe
parents: 3668
diff changeset
274 axis (varargin{:});
5152
b111ca4715c6 [project @ 2005-02-21 19:41:23 by jwe]
jwe
parents: 4945
diff changeset
275 elseif (automatic_replot)
5493
b2e882e8b68b [project @ 2005-10-13 17:51:19 by jwe]
jwe
parents: 5443
diff changeset
276 replot ();
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
277 endif
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
278 endfunction
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
279
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
280 %!demo
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
281 %! t=0:0.01:2*pi; x=sin(t);
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
282 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
283 %! subplot(221); title("normal plot");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
284 %! plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
285 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
286 %! subplot(222); title("square plot");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
287 %! axis("square"); plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
288 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
289 %! subplot(223); title("equal plot");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
290 %! axis("equal"); plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
291 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
292 %! subplot(224); title("normal plot again");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
293 %! axis("normal"); plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
294
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
295 %!demo
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
296 %! t=0:0.01:2*pi; x=sin(t);
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
297 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
298 %! subplot(121); title("ij plot");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
299 %! axis("ij"); plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
300 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
301 %! subplot(122); title("xy plot");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
302 %! axis("xy"); plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
303
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
304 %!demo
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
305 %! t=0:0.01:2*pi; x=sin(t);
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
306 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
307 %! subplot(331); title("x tics & labels");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
308 %! axis("ticx"); plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
309 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
310 %! subplot(332); title("y tics & labels");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
311 %! axis("ticy"); plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
312 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
313 %! subplot(334); title("x & y tics, x labels");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
314 %! axis("labelx","tic"); plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
315 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
316 %! subplot(335); title("x & y tics, y labels");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
317 %! axis("labely","tic"); plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
318 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
319 %! subplot(337); title("x tics, no labels");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
320 %! axis("nolabel","ticx"); plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
321 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
322 %! subplot(338); title("y tics, no labels");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
323 %! axis("nolabel","ticy"); plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
324 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
325 %! subplot(333); title("no tics or labels");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
326 %! axis("off"); plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
327 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
328 %! subplot(336); title("all tics but no labels");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
329 %! axis("nolabel","tic"); plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
330 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
331 %! subplot(339); title("all tics & labels");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
332 %! axis("on"); plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
333
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
334 %!demo
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
335 %! t=0:0.01:2*pi; x=sin(t);
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
336 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
337 %! subplot(321); title("axes at [0 3 0 1]")
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
338 %! axis([0,3,0,1]); plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
339 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
340 %! subplot(322); title("auto");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
341 %! axis("auto"); plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
342 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
343 %! subplot(323); title("manual");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
344 %! plot(t, x, ";sine [0:2pi];"); hold on;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
345 %! axis("manual");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
346 %! 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
347 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
348 %! 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
349 %! axis([0,3,0,1]); axis("autox");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
350 %! plot(t, x, ";sine [0:2pi];");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
351 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
352 %! 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
353 %! axis([3,6,0,1]); axis("autoy");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
354 %! plot(t, x, ";sine [0:2p];");
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(326); title("tight");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
357 %! axis("tight"); plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
358 %! % 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
359 %! % limits, but "tight" isn't implemented yet.