Mercurial > hg > octave-lyh
annotate scripts/plot/plot.m @ 11316:b7ff4a51ea88
plot.m: Eliminate present tense in first sentence of docstring.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Mon, 06 Dec 2010 17:34:15 -0800 |
parents | 3140cb7a05a1 |
children | fd0a3ac60b0e |
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{}) |
11316
b7ff4a51ea88
plot.m: Eliminate present tense in first sentence of docstring.
Rik <octave@nomad.inbox5.com>
parents:
10791
diff
changeset
|
27 ## Produce two-dimensional plots. |
b7ff4a51ea88
plot.m: Eliminate present tense in first sentence of docstring.
Rik <octave@nomad.inbox5.com>
parents:
10791
diff
changeset
|
28 ## |
b7ff4a51ea88
plot.m: Eliminate present tense in first sentence of docstring.
Rik <octave@nomad.inbox5.com>
parents:
10791
diff
changeset
|
29 ## Many different combinations of arguments are possible. The simplest |
b7ff4a51ea88
plot.m: Eliminate present tense in first sentence of docstring.
Rik <octave@nomad.inbox5.com>
parents:
10791
diff
changeset
|
30 ## form is |
3426 | 31 ## |
3368 | 32 ## @example |
33 ## plot (@var{y}) | |
34 ## @end example | |
3426 | 35 ## |
3368 | 36 ## @noindent |
37 ## where the argument is taken as the set of @var{y} coordinates and the | |
11316
b7ff4a51ea88
plot.m: Eliminate present tense in first sentence of docstring.
Rik <octave@nomad.inbox5.com>
parents:
10791
diff
changeset
|
38 ## @var{x} coordinates are taken to be the indices of the elements |
3368 | 39 ## starting with 1. |
3426 | 40 ## |
5798 | 41 ## To save a plot, in one of several image formats such as PostScript |
42 ## or PNG, use the @code{print} command. | |
43 ## | |
3368 | 44 ## If more than one argument is given, they are interpreted as |
3426 | 45 ## |
3368 | 46 ## @example |
6895 | 47 ## plot (@var{y}, @var{property}, @var{value}, @dots{}) |
3368 | 48 ## @end example |
3426 | 49 ## |
3368 | 50 ## @noindent |
6895 | 51 ## or |
6459 | 52 ## |
53 ## @example | |
54 ## plot (@var{x}, @var{y}, @var{property}, @var{value}, @dots{}) | |
55 ## @end example | |
56 ## | |
57 ## @noindent | |
6895 | 58 ## or |
59 ## | |
60 ## @example | |
61 ## plot (@var{x}, @var{y}, @var{fmt}, @dots{}) | |
62 ## @end example | |
63 ## | |
64 ## @noindent | |
65 ## and so on. Any number of argument sets may appear. The @var{x} and | |
66 ## @var{y} values are interpreted as follows: | |
3426 | 67 ## |
3368 | 68 ## @itemize @bullet |
69 ## @item | |
70 ## If a single data argument is supplied, it is taken as the set of @var{y} | |
71 ## coordinates and the @var{x} coordinates are taken to be the indices of | |
72 ## the elements, starting with 1. | |
3426 | 73 ## |
3368 | 74 ## @item |
6672 | 75 ## If the @var{x} is a vector and @var{y} is a matrix, then |
6177 | 76 ## the columns (or rows) of @var{y} are plotted versus @var{x}. |
2311 | 77 ## (using whichever combination matches, with columns tried first.) |
3426 | 78 ## |
3368 | 79 ## @item |
6177 | 80 ## If the @var{x} is a matrix and @var{y} is a vector, |
81 ## @var{y} is plotted versus the columns (or rows) of @var{x}. | |
2311 | 82 ## (using whichever combination matches, with columns tried first.) |
3426 | 83 ## |
3368 | 84 ## @item |
85 ## If both arguments are vectors, the elements of @var{y} are plotted versus | |
86 ## the elements of @var{x}. | |
3426 | 87 ## |
3368 | 88 ## @item |
89 ## If both arguments are matrices, the columns of @var{y} are plotted | |
90 ## versus the columns of @var{x}. In this case, both matrices must have | |
91 ## the same number of rows and columns and no attempt is made to transpose | |
92 ## the arguments to make the number of rows match. | |
3426 | 93 ## |
2311 | 94 ## If both arguments are scalars, a single point is plotted. |
3368 | 95 ## @end itemize |
3426 | 96 ## |
6895 | 97 ## Multiple property-value pairs may be specified, but they must appear |
98 ## in pairs. These arguments are applied to the lines drawn by | |
99 ## @code{plot}. | |
100 ## | |
3368 | 101 ## If the @var{fmt} argument is supplied, it is interpreted as |
102 ## follows. If @var{fmt} is missing, the default gnuplot line style | |
103 ## is assumed. | |
3426 | 104 ## |
3368 | 105 ## @table @samp |
106 ## @item - | |
107 ## Set lines plot style (default). | |
3426 | 108 ## |
3368 | 109 ## @item . |
110 ## Set dots plot style. | |
3426 | 111 ## |
3368 | 112 ## @item @var{n} |
113 ## Interpreted as the plot color if @var{n} is an integer in the range 1 to | |
114 ## 6. | |
3426 | 115 ## |
3368 | 116 ## @item @var{nm} |
117 ## If @var{nm} is a two digit integer and @var{m} is an integer in the | |
118 ## range 1 to 6, @var{m} is interpreted as the point style. This is only | |
119 ## valid in combination with the @code{@@} or @code{-@@} specifiers. | |
3426 | 120 ## |
3368 | 121 ## @item @var{c} |
6177 | 122 ## If @var{c} is one of @code{"k"} (black), @code{"r"} (red), @code{"g"} |
123 ## (green), @code{"b"} (blue), @code{"m"} (magenta), @code{"c"} (cyan), | |
124 ## or @code{"w"} (white), it is interpreted as the line plot color. | |
3426 | 125 ## |
3717 | 126 ## @item ";title;" |
127 ## Here @code{"title"} is the label for the key. | |
128 ## | |
3368 | 129 ## @item + |
130 ## @itemx * | |
131 ## @itemx o | |
132 ## @itemx x | |
8088 | 133 ## @itemx ^ |
3368 | 134 ## Used in combination with the points or linespoints styles, set the point |
135 ## style. | |
10121
b5cc666da6ca
Support the '@' marker that was present in Octave 2.1.x
David Bateman <dbateman@free.fr>
parents:
9245
diff
changeset
|
136 ## |
b5cc666da6ca
Support the '@' marker that was present in Octave 2.1.x
David Bateman <dbateman@free.fr>
parents:
9245
diff
changeset
|
137 ## @item @@ |
b5cc666da6ca
Support the '@' marker that was present in Octave 2.1.x
David Bateman <dbateman@free.fr>
parents:
9245
diff
changeset
|
138 ## Select the next unused point style. |
3368 | 139 ## @end table |
3426 | 140 ## |
6895 | 141 ## The @var{fmt} argument may also be used to assign key titles. |
3683 | 142 ## 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
|
143 ## formatting sequence described above, e.g., "+3;Key Title;" |
3683 | 144 ## Note that the last semi-colon is required and will generate an error if |
145 ## it is left out. | |
146 ## | |
3368 | 147 ## Here are some plot examples: |
3426 | 148 ## |
3368 | 149 ## @example |
150 ## plot (x, y, "@@12", x, y2, x, y3, "4", x, y4, "+") | |
151 ## @end example | |
3426 | 152 ## |
3368 | 153 ## This command will plot @code{y} with points of type 2 (displayed as |
154 ## @samp{+}) and color 1 (red), @code{y2} with lines, @code{y3} with lines of | |
155 ## color 4 (magenta) and @code{y4} with points displayed as @samp{+}. | |
3426 | 156 ## |
3368 | 157 ## @example |
6459 | 158 ## plot (b, "*", "markersize", 3) |
3368 | 159 ## @end example |
3426 | 160 ## |
6672 | 161 ## This command will plot the data in the variable @code{b}, |
6459 | 162 ## with points displayed as @samp{*} with a marker size of 3. |
3683 | 163 ## |
164 ## @example | |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
9040
diff
changeset
|
165 ## @group |
3683 | 166 ## t = 0:0.1:6.3; |
167 ## 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
|
168 ## @end group |
3683 | 169 ## @end example |
170 ## | |
171 ## This will plot the cosine and sine functions and label them accordingly | |
172 ## in the key. | |
6820 | 173 ## |
174 ## If the first argument is an axis handle, then plot into these axes, | |
175 ## rather than the current axis handle returned by @code{gca}. | |
10791
3140cb7a05a1
Add spellchecker scripts for Octave and run spellcheck of documentation
Rik <octave@nomad.inbox5.com>
parents:
10730
diff
changeset
|
176 ## |
6895 | 177 ## @seealso{semilogx, semilogy, loglog, polar, mesh, contour, bar, |
178 ## stairs, errorbar, xlabel, ylabel, title, print} | |
3368 | 179 ## @end deftypefn |
4 | 180 |
2314 | 181 ## Author: jwe |
182 | |
6302 | 183 function retval = plot (varargin) |
4 | 184 |
10730
390d93e20531
Plot commands now print usage information without errors
Rik <octave@nomad.inbox5.com>
parents:
10687
diff
changeset
|
185 [h, varargin, nargs] = __plt_get_axis_arg__ ("plot", varargin{:}); |
390d93e20531
Plot commands now print usage information without errors
Rik <octave@nomad.inbox5.com>
parents:
10687
diff
changeset
|
186 |
390d93e20531
Plot commands now print usage information without errors
Rik <octave@nomad.inbox5.com>
parents:
10687
diff
changeset
|
187 if (nargs < 1) |
390d93e20531
Plot commands now print usage information without errors
Rik <octave@nomad.inbox5.com>
parents:
10687
diff
changeset
|
188 print_usage(); |
390d93e20531
Plot commands now print usage information without errors
Rik <octave@nomad.inbox5.com>
parents:
10687
diff
changeset
|
189 endif |
7216 | 190 |
7215 | 191 oldh = gca (); |
192 unwind_protect | |
193 axes (h); | |
6820 | 194 newplot (); |
7215 | 195 tmp = __plt__ ("plot", h, varargin{:}); |
196 unwind_protect_cleanup | |
197 axes (oldh); | |
198 end_unwind_protect | |
6302 | 199 |
200 if (nargout > 0) | |
201 retval = tmp; | |
202 endif | |
4 | 203 |
204 endfunction |