245
|
1 # Copyright (C) 1993 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 |
4
|
19 function plot (x1, x2) |
|
20 |
|
21 # usage: plot (x, y) |
|
22 # |
|
23 # If the first argument is a vector and the second is a matrix, the |
|
24 # the vector is plotted versus the columns (or rows) of the matrix. |
|
25 # (using whichever combination matches, with columns tried first.) |
|
26 # |
|
27 # If the first argument is a matrix and the second is a vector, the |
|
28 # the columns (or rows) of the matrix are plotted versus the vector. |
|
29 # (using whichever combination matches, with columns tried first.) |
|
30 # |
|
31 # If both arguments are vectors, the elements of y are plotted versus |
|
32 # the elements of x. |
|
33 # |
|
34 # If both arguments are matrices, the columns of y are plotted versus |
|
35 # the columns of x. In this case, both matrices must have the same |
|
36 # number of rows and columns and no attempt is made to transpose the |
|
37 # arguments to make the number of rows match. |
|
38 # |
|
39 # If both arguments are scalars, a single point is plotted. |
|
40 # |
|
41 # If only one argument is given, it is taken as the set of y |
|
42 # coordinates and the x coordinates are taken to be the indices of the |
|
43 # elements, starting with 1. |
|
44 # |
|
45 # See also: semilogx, semilogy, loglog, polar, mesh, contour, |
|
46 # bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title |
|
47 |
|
48 set nologscale; |
|
49 set nopolar; |
|
50 |
|
51 if (nargin == 1) |
|
52 plot_int (x1); |
|
53 elseif (nargin == 2) |
|
54 plot_int (x1, x2); |
|
55 else |
|
56 usage = sprintf ("usage: plot (x)\n"); |
|
57 usage = sprintf ("%s plot (x, y)", usage); |
|
58 error (usage); |
|
59 endif |
|
60 |
|
61 endfunction |