annotate scripts/plot/axis.m @ 4030:22bd65326ec1

[project @ 2002-08-09 18:58:13 by jwe]
author jwe
date Fri, 09 Aug 2002 19:00:16 +0000
parents e0b7a493e5a8
children 0493a367de6f
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
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
17 ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
18 ## 02111-1307, 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 ##
3368
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 3106
diff changeset
29 ## If your plot is already drawn, then you need to use @code{replot} before
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 3106
diff changeset
30 ## the new axis limits will take effect. You can get this to happen
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 3106
diff changeset
31 ## automatically by setting the built-in variable @code{automatic_replot}
a4cd1e9d9962 [project @ 1999-11-20 17:22:48 by jwe]
jwe
parents: 3106
diff changeset
32 ## to a nonzero value.
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
33 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
34 ## Without any arguments, @code{axis} turns autoscaling on.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
35 ##
3668
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
36 ## The vector argument specifying limits is optional, and additional
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
37 ## 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
38 ## example,
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
39 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
40 ## @example
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
41 ## axis ([1, 2, 3, 4], "square");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
42 ## @end example
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
43 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
44 ## @noindent
3668
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
45 ## forces a square aspect ratio, and
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
46 ##
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
47 ## @example
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
48 ## axis ("labely", "tic");
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
49 ## @end example
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
50 ##
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
51 ## @noindent
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
52 ## 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
53 ## only.
3667
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 ## @noindent
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
56 ## 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
57 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
58 ## @table @code
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
59 ## @item "square"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
60 ## Force a square aspect ratio.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
61 ## @item "equal"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
62 ## Force x distance to equal y-distance.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
63 ## @item "normal"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
64 ## Restore the balance.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
65 ## @end table
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 ## @noindent
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
68 ## 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
69 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
70 ## @table @code
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
71 ## @item "auto"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
72 ## 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
73 ## or all if no axes are specified.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
74 ## @item "manual"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
75 ## Fix the current axes limits.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
76 ## @item "tight"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
77 ## 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
78 ## @end table
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
79 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
80 ## @noindent
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
81 ## 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
82 ## @code{"equal"}.
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 ## @noindent
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
85 ## The following options affect the appearance of tic marks.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
86 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
87 ## @table @code
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
88 ## @item "on"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
89 ## Turn tic marks and labels on for all axes.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
90 ## @item "off"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
91 ## Turn tic marks off for all axes.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
92 ## @item "tic[xyz]"
3668
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
93 ## 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
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 "label[xyz]"
3668
b0a68efa1295 [project @ 2000-05-13 06:40:56 by jwe]
jwe
parents: 3667
diff changeset
96 ## 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
97 ## specified axes and off for the remainder.
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
98 ## @item "nolabel"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
99 ## Turn tic labels off for all axes.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
100 ## @end table
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
101 ## 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
102 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
103 ## @noindent
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
104 ## 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
105 ## the axes.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
106 ##
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
107 ## @table @code
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
108 ## @item "ij"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
109 ## 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
110 ## @item "xy"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
111 ## 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
112 ## @end table
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
3979
e0b7a493e5a8 [project @ 2002-07-10 17:45:34 by jwe]
jwe
parents: 3668
diff changeset
117 function curr_axis = axis (ax, varargin)
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
118
2303
5cffc4b8de57 [project @ 1996-06-24 09:15:24 by jwe]
jwe
parents: 1887
diff changeset
119 ## 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
120 ## directly...
1610
26a096727e89 [project @ 1995-11-03 05:57:27 by jwe]
jwe
parents: 1315
diff changeset
121
3106
21208b797332 [project @ 1997-11-19 06:26:03 by jwe]
jwe
parents: 2847
diff changeset
122 global __current_axis__ = [-10, 10, -10, 10];
1610
26a096727e89 [project @ 1995-11-03 05:57:27 by jwe]
jwe
parents: 1315
diff changeset
123
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
124 ## 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
125 ## It isn't hard to compute good axis limits:
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
126 ## scale = 10 ^ floor (log10 (max - min) - 1);
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
127 ## r = scale * [floor (min / scale), ceil (max / scale)];
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
128 ## 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
129 ## limits.
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
130
595
a0cc17145462 [project @ 1994-08-09 18:42:23 by jwe]
jwe
parents: 594
diff changeset
131 if (nargin == 0)
2520
a034dcdbc282 [project @ 1996-11-15 04:57:21 by jwe]
jwe
parents: 2325
diff changeset
132 gset autoscale;
1610
26a096727e89 [project @ 1995-11-03 05:57:27 by jwe]
jwe
parents: 1315
diff changeset
133 curr_axis = __current_axis__;
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
134
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
135 elseif (isstr (ax))
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
136 ax = tolower (ax);
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
137
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
138 ## 'matrix mode' to reverse the y-axis
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
139 if (strcmp (ax, "ij"))
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
140 gset yrange [] reverse;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
141 elseif (strcmp (ax, "xy"))
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
142 gset yrange [] noreverse;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
143
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
144 ## aspect ratio
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
145 elseif (strcmp (ax, "image"))
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
146 gset size ratio -1;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
147 gset autoscale; ## XXX FIXME XXX should be the same as "tight"
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
148 elseif (strcmp (ax, "equal"))
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
149 gset size ratio -1;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
150 elseif (strcmp (ax, "square"))
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
151 gset size ratio 1;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
152 elseif (strcmp (ax, "normal"))
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
153 gset size noratio;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
154
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
155
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
156 ## axis limits
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
157 elseif (length (ax) >= 4 && strcmp (ax (1:4), "auto"))
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
158 if length (ax) > 4
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
159 eval (["gset autoscale ", ax (5 : length (ax)), ";"]);
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
160 else
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
161 gset autoscale;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
162 endif
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
163 elseif (strcmp (ax, "manual"))
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
164 ## fixes the axis limits, like axis(axis) should;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
165 gset xrange [] writeback;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
166 gset yrange [] writeback;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
167 gset zrange [] writeback;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
168 ## XXX FIXME XXX if writeback were set in plot, no need to replot here.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
169 replot;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
170 gset noautoscale x;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
171 gset noautoscale y;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
172 gset noautoscale z;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
173 elseif (strcmp (ax, "tight"))
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
174 ## XXX FIXME XXX if tight, plot must set ranges to limits of the
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
175 ## 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
176 ## Instead, just let gnuplot do as it likes.
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
177 gset autoscale;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
178
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
179
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
180 ## tic marks
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
181 elseif (strcmp (ax, "on"))
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
182 gset xtics;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
183 gset ytics;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
184 gset ztics;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
185 gset format;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
186 elseif (strcmp (ax, "off"))
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
187 gset noxtics;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
188 gset noytics;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
189 gset noztics;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
190 elseif (strcmp (ax, "tic"))
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
191 gset xtics;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
192 gset ytics;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
193 gset ztics;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
194 elseif (length (ax) > 3 && strcmp (ax (1:3), "tic"))
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
195 if any (ax == "x")
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
196 gset xtics;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
197 else
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
198 gset noxtics;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
199 endif
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
200 if any (ax == "y")
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
201 gset ytics;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
202 else
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
203 gset noytics;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
204 endif
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
205 if any (ax == "z")
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
206 gset ztics;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
207 else
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
208 gset noztics;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
209 endif
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
210 elseif (strcmp (ax, "label"))
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
211 gset format;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
212 elseif (strcmp (ax, "nolabel"))
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
213 gset format "\\0";
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
214 elseif (length (ax) > 5 && strcmp (ax (1:5), "label"))
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
215 if any (ax == "x")
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
216 gset format x;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
217 else
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
218 gset format x "\\0";
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
219 endif
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
220 if any (ax == "y")
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
221 gset format y;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
222 else
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
223 gset format y "\\0";
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
224 endif
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
225 if any (ax == "z")
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
226 gset format z;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
227 else
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
228 gset format z "\\0";
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
229 endif
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
230
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
231 else
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
232 warning (["unknown axis option '", ax, "'"]);
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
233 endif
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
234
4030
22bd65326ec1 [project @ 2002-08-09 18:58:13 by jwe]
jwe
parents: 3979
diff changeset
235 elseif (isvector (ax))
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
236
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
237 len = length (ax);
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
238
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
239 if (len != 2 && len != 4 && len != 6)
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
240 error ("axis: expecting vector with 2, 4, or 6 elements");
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
241 endif
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
242
1610
26a096727e89 [project @ 1995-11-03 05:57:27 by jwe]
jwe
parents: 1315
diff changeset
243 __current_axis__ = reshape (ax, 1, len);
26a096727e89 [project @ 1995-11-03 05:57:27 by jwe]
jwe
parents: 1315
diff changeset
244
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
245 if (len > 1)
2520
a034dcdbc282 [project @ 1996-11-15 04:57:21 by jwe]
jwe
parents: 2325
diff changeset
246 eval (sprintf ("gset xrange [%g:%g];", ax (1), ax (2)));
590
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
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
249 if (len > 3)
2520
a034dcdbc282 [project @ 1996-11-15 04:57:21 by jwe]
jwe
parents: 2325
diff changeset
250 eval (sprintf ("gset yrange [%g:%g];", ax (3), ax (4)));
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
251 endif
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
252
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
253 if (len > 5)
2520
a034dcdbc282 [project @ 1996-11-15 04:57:21 by jwe]
jwe
parents: 2325
diff changeset
254 eval (sprintf ("gset zrange [%g:%g];", ax (5), ax (6)));
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
255 endif
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
256
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
257 else
595
a0cc17145462 [project @ 1994-08-09 18:42:23 by jwe]
jwe
parents: 594
diff changeset
258 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
259 endif
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
260
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
261 if (nargin > 1)
3979
e0b7a493e5a8 [project @ 2002-07-10 17:45:34 by jwe]
jwe
parents: 3668
diff changeset
262 axis (varargin{:});
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
263 endif
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
264 endfunction
3667
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
265
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
266 %!demo
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
267 %! t=0:0.01:2*pi; x=sin(t);
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
268 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
269 %! subplot(221); title("normal plot");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
270 %! plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
271 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
272 %! subplot(222); title("square plot");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
273 %! axis("square"); plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
274 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
275 %! subplot(223); title("equal plot");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
276 %! axis("equal"); plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
277 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
278 %! subplot(224); title("normal plot again");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
279 %! axis("normal"); plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
280
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
281 %!demo
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
282 %! t=0:0.01:2*pi; x=sin(t);
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
283 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
284 %! subplot(121); title("ij plot");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
285 %! axis("ij"); plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
286 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
287 %! subplot(122); title("xy plot");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
288 %! axis("xy"); plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
289
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
290 %!demo
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
291 %! t=0:0.01:2*pi; x=sin(t);
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
292 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
293 %! subplot(331); title("x tics & labels");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
294 %! axis("ticx"); plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
295 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
296 %! subplot(332); title("y tics & labels");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
297 %! axis("ticy"); plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
298 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
299 %! subplot(334); title("x & y tics, x labels");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
300 %! axis("labelx","tic"); plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
301 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
302 %! subplot(335); title("x & y tics, y labels");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
303 %! axis("labely","tic"); plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
304 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
305 %! subplot(337); title("x tics, no labels");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
306 %! axis("nolabel","ticx"); plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
307 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
308 %! subplot(338); title("y tics, no labels");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
309 %! axis("nolabel","ticy"); plot(t, x, ";;");
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(333); title("no tics or labels");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
312 %! axis("off"); plot(t, x, ";;");
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(336); title("all tics but no labels");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
315 %! axis("nolabel","tic"); plot(t, x, ";;");
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(339); title("all tics & labels");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
318 %! axis("on"); plot(t, x, ";;");
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 %!demo
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
321 %! t=0:0.01:2*pi; x=sin(t);
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 %! subplot(321); title("axes at [0 3 0 1]")
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
324 %! axis([0,3,0,1]); plot(t, x, ";;");
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(322); title("auto");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
327 %! axis("auto"); plot(t, x, ";;");
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(323); title("manual");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
330 %! plot(t, x, ";sine [0:2pi];"); hold on;
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
331 %! axis("manual");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
332 %! 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
333 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
334 %! 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
335 %! axis([0,3,0,1]); axis("autox");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
336 %! plot(t, x, ";sine [0:2pi];");
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(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
339 %! axis([3,6,0,1]); axis("autoy");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
340 %! plot(t, x, ";sine [0:2p];");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
341 %!
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
342 %! subplot(326); title("tight");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
343 %! axis("tight"); plot(t, x, ";;");
f7f94396dd81 [project @ 2000-05-13 06:31:28 by jwe]
jwe
parents: 3426
diff changeset
344 %! % 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
345 %! % limits, but "tight" isn't implemented yet.