comparison scripts/plot/axis.m @ 590:8e42786004d6

[project @ 1994-08-09 01:18:13 by jwe] Initial revision
author jwe
date Tue, 09 Aug 1994 01:18:13 +0000
parents
children 45172f0adca5
comparison
equal deleted inserted replaced
589:81b973e373f9 590:8e42786004d6
1 # Copyright (C) 1993, 1994 John W. Eaton
2 #
3 # This file is part of Octave.
4 #
5 # Octave is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by the
7 # Free Software Foundation; either version 2, or (at your option) any
8 # later version.
9 #
10 # Octave is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 # for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with Octave; see the file COPYING. If not, write to the Free
17 # Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 function axis (ax)
20
21 # usage: axis ([xmin, xmax])
22 # axis ([xmin, xmax, ymin, ymax])
23 # axis ([xmin, xmax, ymin, ymax, zmin, zmax])
24 #
25 # Sets the axis limits.
26 #
27 # If your plot is already drawn, then you need to REPLOT before
28 # the new axis limits will take effect.
29
30 if (nargin != 1)
31 error ("usage: axis ([xmin, xmax, ymin, ymax, zmin, zmax])");
32 endif
33
34 if (is_vector (ax))
35
36 len = length (ax);
37
38 if (len != 2 && len != 4 && len != 6)
39 error ("axis: expecting vector with 2, 4, or 6 elements");
40 endif
41
42 if (len > 1)
43 eval (sprintf ("set xrange [%d:%d];", ax (1), ax (2)));
44 endif
45
46 if (len > 3)
47 eval (sprintf ("set yrange [%d:%d];", ax (3), ax (4)));
48 endif
49
50 if (len > 5)
51 eval (sprintf ("set zrange [%d:%d];", ax (5), ax (6)));
52 endif
53
54 else
55 error ("axis: expecting vector with 2, 4, or 6 elements");
56 endif
57
58 endfunction