1014
|
1 # Copyright (C) 1993, 1994, 1995 John W. Eaton |
590
|
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 |
1315
|
17 # Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
590
|
18 |
|
19 function axis (ax) |
|
20 |
595
|
21 # usage: axis () |
|
22 # axis ([xmin, xmax]) |
590
|
23 # axis ([xmin, xmax, ymin, ymax]) |
|
24 # axis ([xmin, xmax, ymin, ymax, zmin, zmax]) |
|
25 # |
|
26 # Sets the axis limits. |
|
27 # |
595
|
28 # With no arguments, turns autoscaling on. |
|
29 # |
590
|
30 # If your plot is already drawn, then you need to REPLOT before |
|
31 # the new axis limits will take effect. |
|
32 |
595
|
33 if (nargin > 1) |
904
|
34 usage ("axis ([xmin, xmax, ymin, ymax, zmin, zmax])"); |
590
|
35 endif |
|
36 |
595
|
37 if (nargin == 0) |
|
38 set autoscale; |
|
39 elseif (is_vector (ax)) |
590
|
40 |
|
41 len = length (ax); |
|
42 |
|
43 if (len != 2 && len != 4 && len != 6) |
|
44 error ("axis: expecting vector with 2, 4, or 6 elements"); |
|
45 endif |
|
46 |
|
47 if (len > 1) |
594
|
48 eval (sprintf ("set xrange [%g:%g];", ax (1), ax (2))); |
590
|
49 endif |
|
50 |
|
51 if (len > 3) |
594
|
52 eval (sprintf ("set yrange [%g:%g];", ax (3), ax (4))); |
590
|
53 endif |
|
54 |
|
55 if (len > 5) |
594
|
56 eval (sprintf ("set zrange [%g:%g];", ax (5), ax (6))); |
590
|
57 endif |
|
58 |
|
59 else |
595
|
60 error ("axis: expecting no args, or a vector with 2, 4, or 6 elements"); |
590
|
61 endif |
|
62 |
|
63 endfunction |