Mercurial > hg > octave-nkf
annotate scripts/plot/plot.m @ 10687:a8ce6bdecce5
Improve documentation strings.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Tue, 08 Jun 2010 20:22:38 -0700 |
parents | b5cc666da6ca |
children | 390d93e20531 |
rev | line source |
---|---|
7017 | 1 ## Copyright (C) 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2002, 2004, |
9245 | 2 ## 2005, 2006, 2007, 2008, 2009 John W. Eaton |
2313 | 3 ## |
4 ## This file is part of Octave. | |
5 ## | |
6 ## Octave is free software; you can redistribute it and/or modify it | |
7 ## under the terms of the GNU General Public License as published by | |
7016 | 8 ## the Free Software Foundation; either version 3 of the License, or (at |
9 ## your option) any later version. | |
2313 | 10 ## |
11 ## Octave is distributed in the hope that it will be useful, but | |
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 ## General Public License for more details. | |
15 ## | |
16 ## You should have received a copy of the GNU General Public License | |
7016 | 17 ## along with Octave; see the file COPYING. If not, see |
18 ## <http://www.gnu.org/licenses/>. | |
245 | 19 |
3368 | 20 ## -*- texinfo -*- |
10687
a8ce6bdecce5
Improve documentation strings.
Rik <octave@nomad.inbox5.com>
parents:
10121
diff
changeset
|
21 ## @deftypefn {Function File} {} plot (@var{y}) |
6895 | 22 ## @deftypefnx {Function File} {} plot (@var{x}, @var{y}) |
23 ## @deftypefnx {Function File} {} plot (@var{x}, @var{y}, @var{property}, @var{value}, @dots{}) | |
24 ## @deftypefnx {Function File} {} plot (@var{x}, @var{y}, @var{fmt}) | |
25 ## @deftypefnx {Function File} {} plot (@var{h}, @dots{}) | |
10687
a8ce6bdecce5
Improve documentation strings.
Rik <octave@nomad.inbox5.com>
parents:
10121
diff
changeset
|
26 ## @deftypefnx {Function File} {@var{h} =} plot (@dots{}) |
6895 | 27 ## Produces two-dimensional plots. Many different combinations of |
28 ## arguments are possible. The simplest form is | |
3426 | 29 ## |
3368 | 30 ## @example |
31 ## plot (@var{y}) | |
32 ## @end example | |
3426 | 33 ## |
3368 | 34 ## @noindent |
35 ## where the argument is taken as the set of @var{y} coordinates and the | |
36 ## @var{x} coordinates are taken to be the indices of the elements, | |
37 ## starting with 1. | |
3426 | 38 ## |
5798 | 39 ## To save a plot, in one of several image formats such as PostScript |
40 ## or PNG, use the @code{print} command. | |
41 ## | |
3368 | 42 ## If more than one argument is given, they are interpreted as |
3426 | 43 ## |
3368 | 44 ## @example |
6895 | 45 ## plot (@var{y}, @var{property}, @var{value}, @dots{}) |
3368 | 46 ## @end example |
3426 | 47 ## |
3368 | 48 ## @noindent |
6895 | 49 ## or |
6459 | 50 ## |
51 ## @example | |
52 ## plot (@var{x}, @var{y}, @var{property}, @var{value}, @dots{}) | |
53 ## @end example | |
54 ## | |
55 ## @noindent | |
6895 | 56 ## or |
57 ## | |
58 ## @example | |
59 ## plot (@var{x}, @var{y}, @var{fmt}, @dots{}) | |
60 ## @end example | |
61 ## | |
62 ## @noindent | |
63 ## and so on. Any number of argument sets may appear. The @var{x} and | |
64 ## @var{y} values are interpreted as follows: | |
3426 | 65 ## |
3368 | 66 ## @itemize @bullet |
67 ## @item | |
68 ## If a single data argument is supplied, it is taken as the set of @var{y} | |
69 ## coordinates and the @var{x} coordinates are taken to be the indices of | |
70 ## the elements, starting with 1. | |
3426 | 71 ## |
3368 | 72 ## @item |
6672 | 73 ## If the @var{x} is a vector and @var{y} is a matrix, then |
6177 | 74 ## the columns (or rows) of @var{y} are plotted versus @var{x}. |
2311 | 75 ## (using whichever combination matches, with columns tried first.) |
3426 | 76 ## |
3368 | 77 ## @item |
6177 | 78 ## If the @var{x} is a matrix and @var{y} is a vector, |
79 ## @var{y} is plotted versus the columns (or rows) of @var{x}. | |
2311 | 80 ## (using whichever combination matches, with columns tried first.) |
3426 | 81 ## |
3368 | 82 ## @item |
83 ## If both arguments are vectors, the elements of @var{y} are plotted versus | |
84 ## the elements of @var{x}. | |
3426 | 85 ## |
3368 | 86 ## @item |
87 ## If both arguments are matrices, the columns of @var{y} are plotted | |
88 ## versus the columns of @var{x}. In this case, both matrices must have | |
89 ## the same number of rows and columns and no attempt is made to transpose | |
90 ## the arguments to make the number of rows match. | |
3426 | 91 ## |
2311 | 92 ## If both arguments are scalars, a single point is plotted. |
3368 | 93 ## @end itemize |
3426 | 94 ## |
6895 | 95 ## Multiple property-value pairs may be specified, but they must appear |
96 ## in pairs. These arguments are applied to the lines drawn by | |
97 ## @code{plot}. | |
98 ## | |
3368 | 99 ## If the @var{fmt} argument is supplied, it is interpreted as |
100 ## follows. If @var{fmt} is missing, the default gnuplot line style | |
101 ## is assumed. | |
3426 | 102 ## |
3368 | 103 ## @table @samp |
104 ## @item - | |
105 ## Set lines plot style (default). | |
3426 | 106 ## |
3368 | 107 ## @item . |
108 ## Set dots plot style. | |
3426 | 109 ## |
3368 | 110 ## @item @var{n} |
111 ## Interpreted as the plot color if @var{n} is an integer in the range 1 to | |
112 ## 6. | |
3426 | 113 ## |
3368 | 114 ## @item @var{nm} |
115 ## If @var{nm} is a two digit integer and @var{m} is an integer in the | |
116 ## range 1 to 6, @var{m} is interpreted as the point style. This is only | |
117 ## valid in combination with the @code{@@} or @code{-@@} specifiers. | |
3426 | 118 ## |
3368 | 119 ## @item @var{c} |
6177 | 120 ## If @var{c} is one of @code{"k"} (black), @code{"r"} (red), @code{"g"} |
121 ## (green), @code{"b"} (blue), @code{"m"} (magenta), @code{"c"} (cyan), | |
122 ## or @code{"w"} (white), it is interpreted as the line plot color. | |
3426 | 123 ## |
3717 | 124 ## @item ";title;" |
125 ## Here @code{"title"} is the label for the key. | |
126 ## | |
3368 | 127 ## @item + |
128 ## @itemx * | |
129 ## @itemx o | |
130 ## @itemx x | |
8088 | 131 ## @itemx ^ |
3368 | 132 ## Used in combination with the points or linespoints styles, set the point |
133 ## style. | |
10121
b5cc666da6ca
Support the '@' marker that was present in Octave 2.1.x
David Bateman <dbateman@free.fr>
parents:
9245
diff
changeset
|
134 ## |
b5cc666da6ca
Support the '@' marker that was present in Octave 2.1.x
David Bateman <dbateman@free.fr>
parents:
9245
diff
changeset
|
135 ## @item @@ |
b5cc666da6ca
Support the '@' marker that was present in Octave 2.1.x
David Bateman <dbateman@free.fr>
parents:
9245
diff
changeset
|
136 ## Select the next unused point style. |
3368 | 137 ## @end table |
3426 | 138 ## |
6895 | 139 ## The @var{fmt} argument may also be used to assign key titles. |
3683 | 140 ## To do so, include the desired title between semi-colons after the |
9040
dbd0c77e575e
Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
141 ## formatting sequence described above, e.g., "+3;Key Title;" |
3683 | 142 ## Note that the last semi-colon is required and will generate an error if |
143 ## it is left out. | |
144 ## | |
3368 | 145 ## Here are some plot examples: |
3426 | 146 ## |
3368 | 147 ## @example |
148 ## plot (x, y, "@@12", x, y2, x, y3, "4", x, y4, "+") | |
149 ## @end example | |
3426 | 150 ## |
3368 | 151 ## This command will plot @code{y} with points of type 2 (displayed as |
152 ## @samp{+}) and color 1 (red), @code{y2} with lines, @code{y3} with lines of | |
153 ## color 4 (magenta) and @code{y4} with points displayed as @samp{+}. | |
3426 | 154 ## |
3368 | 155 ## @example |
6459 | 156 ## plot (b, "*", "markersize", 3) |
3368 | 157 ## @end example |
3426 | 158 ## |
6672 | 159 ## This command will plot the data in the variable @code{b}, |
6459 | 160 ## with points displayed as @samp{*} with a marker size of 3. |
3683 | 161 ## |
162 ## @example | |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
9040
diff
changeset
|
163 ## @group |
3683 | 164 ## t = 0:0.1:6.3; |
165 ## plot (t, cos(t), "-;cos(t);", t, sin(t), "+3;sin(t);"); | |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
9040
diff
changeset
|
166 ## @end group |
3683 | 167 ## @end example |
168 ## | |
169 ## This will plot the cosine and sine functions and label them accordingly | |
170 ## in the key. | |
6820 | 171 ## |
172 ## If the first argument is an axis handle, then plot into these axes, | |
173 ## rather than the current axis handle returned by @code{gca}. | |
6895 | 174 ## @seealso{semilogx, semilogy, loglog, polar, mesh, contour, bar, |
175 ## stairs, errorbar, xlabel, ylabel, title, print} | |
3368 | 176 ## @end deftypefn |
4 | 177 |
2314 | 178 ## Author: jwe |
179 | |
6302 | 180 function retval = plot (varargin) |
4 | 181 |
7215 | 182 [h, varargin] = __plt_get_axis_arg__ ("plot", varargin{:}); |
7216 | 183 |
7215 | 184 oldh = gca (); |
185 unwind_protect | |
186 axes (h); | |
6820 | 187 newplot (); |
7215 | 188 tmp = __plt__ ("plot", h, varargin{:}); |
189 unwind_protect_cleanup | |
190 axes (oldh); | |
191 end_unwind_protect | |
6302 | 192 |
193 if (nargout > 0) | |
194 retval = tmp; | |
195 endif | |
4 | 196 |
197 endfunction |