annotate scripts/plot/axis.m @ 1315:611d403c7f3d

[project @ 1995-06-25 19:56:32 by jwe]
author jwe
date Sun, 25 Jun 1995 19:56:32 +0000
parents 3f257ab07921
children 26a096727e89
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1014
3f257ab07921 [project @ 1995-01-04 19:06:56 by jwe]
jwe
parents: 904
diff changeset
1 # Copyright (C) 1993, 1994, 1995 John W. Eaton
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
2 #
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
3 # This file is part of Octave.
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
4 #
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
5 # Octave is free software; you can redistribute it and/or modify it
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
6 # under the terms of the GNU General Public License as published by the
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
7 # Free Software Foundation; either version 2, or (at your option) any
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
8 # later version.
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
9 #
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
10 # Octave is distributed in the hope that it will be useful, but WITHOUT
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
13 # for more details.
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
14 #
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
15 # You should have received a copy of the GNU General Public License
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
16 # along with Octave; see the file COPYING. If not, write to the Free
1315
611d403c7f3d [project @ 1995-06-25 19:56:32 by jwe]
jwe
parents: 1014
diff changeset
17 # Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
18
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
19 function axis (ax)
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
20
595
a0cc17145462 [project @ 1994-08-09 18:42:23 by jwe]
jwe
parents: 594
diff changeset
21 # usage: axis ()
a0cc17145462 [project @ 1994-08-09 18:42:23 by jwe]
jwe
parents: 594
diff changeset
22 # axis ([xmin, xmax])
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
23 # axis ([xmin, xmax, ymin, ymax])
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
24 # axis ([xmin, xmax, ymin, ymax, zmin, zmax])
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
25 #
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
26 # Sets the axis limits.
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
27 #
595
a0cc17145462 [project @ 1994-08-09 18:42:23 by jwe]
jwe
parents: 594
diff changeset
28 # With no arguments, turns autoscaling on.
a0cc17145462 [project @ 1994-08-09 18:42:23 by jwe]
jwe
parents: 594
diff changeset
29 #
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
30 # If your plot is already drawn, then you need to REPLOT before
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
31 # the new axis limits will take effect.
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
32
595
a0cc17145462 [project @ 1994-08-09 18:42:23 by jwe]
jwe
parents: 594
diff changeset
33 if (nargin > 1)
904
3470f1e25a79 [project @ 1994-11-09 21:22:15 by jwe]
jwe
parents: 595
diff changeset
34 usage ("axis ([xmin, xmax, ymin, ymax, zmin, zmax])");
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
35 endif
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
36
595
a0cc17145462 [project @ 1994-08-09 18:42:23 by jwe]
jwe
parents: 594
diff changeset
37 if (nargin == 0)
a0cc17145462 [project @ 1994-08-09 18:42:23 by jwe]
jwe
parents: 594
diff changeset
38 set autoscale;
a0cc17145462 [project @ 1994-08-09 18:42:23 by jwe]
jwe
parents: 594
diff changeset
39 elseif (is_vector (ax))
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
40
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
41 len = length (ax);
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
42
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
43 if (len != 2 && len != 4 && len != 6)
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
44 error ("axis: expecting vector with 2, 4, or 6 elements");
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
45 endif
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
46
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
47 if (len > 1)
594
45172f0adca5 [project @ 1994-08-09 05:38:41 by jwe]
jwe
parents: 590
diff changeset
48 eval (sprintf ("set xrange [%g:%g];", ax (1), ax (2)));
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
49 endif
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
50
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
51 if (len > 3)
594
45172f0adca5 [project @ 1994-08-09 05:38:41 by jwe]
jwe
parents: 590
diff changeset
52 eval (sprintf ("set yrange [%g:%g];", ax (3), ax (4)));
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
53 endif
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
54
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
55 if (len > 5)
594
45172f0adca5 [project @ 1994-08-09 05:38:41 by jwe]
jwe
parents: 590
diff changeset
56 eval (sprintf ("set zrange [%g:%g];", ax (5), ax (6)));
590
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
57 endif
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
58
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
59 else
595
a0cc17145462 [project @ 1994-08-09 18:42:23 by jwe]
jwe
parents: 594
diff changeset
60 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
61 endif
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
62
8e42786004d6 [project @ 1994-08-09 01:18:13 by jwe]
jwe
parents:
diff changeset
63 endfunction