2333
|
1 @c Copyright (C) 1996 John W. Eaton |
|
2 @c This is part of the Octave manual. |
|
3 @c For copying conditions, see the file gpl.texi. |
|
4 |
|
5 @node Plotting, Image Processing, Statistics, Top |
|
6 @chapter Plotting |
|
7 |
|
8 All of Octave's plotting functions use @code{gnuplot} to handle the |
|
9 actual graphics. There are two low-level functions, @code{gplot} and |
|
10 @code{gsplot}, that behave almost exactly like the corresponding |
|
11 @code{gnuplot} functions @code{plot} and @samp{splot}. A number of |
|
12 other higher level plotting functions, patterned after the graphics |
|
13 functions found in @sc{Matlab} version 3.5, are also available. |
|
14 These higher level functions are all implemented in terms of the two |
|
15 low-level plotting functions. |
|
16 |
|
17 @menu |
|
18 * Two-Dimensional Plotting:: |
|
19 * Three-Dimensional Plotting:: |
|
20 * Miscellaneous Plotting Functions:: |
|
21 @end menu |
|
22 |
|
23 @node Two-Dimensional Plotting, Three-Dimensional Plotting, Plotting, Plotting |
|
24 @section Two-Dimensional Plotting |
|
25 |
2449
|
26 @deffn {Command} gplot @var{ranges} @var{expression} @var{using} @var{title} @var{style} |
|
27 Generate a 2-dimensional plot. |
2333
|
28 |
2449
|
29 The @var{ranges}, @var{using}, @var{title}, and @var{style} arguments |
|
30 are optional, and the @var{using}, @var{title} and @var{style} |
2333
|
31 qualifiers may appear in any order after the expression. You may plot |
|
32 multiple expressions with a single command by separating them with |
|
33 commas. Each expression may have its own set of qualifiers. |
|
34 |
|
35 The optional item @var{ranges} has the syntax |
|
36 |
|
37 @example |
|
38 [ x_lo : x_up ] [ y_lo : y_up ] |
|
39 @end example |
|
40 |
|
41 @noindent |
|
42 and may be used to specify the ranges for the axes of the plot, |
|
43 independent of the actual range of the data. The range for the y axes |
|
44 and any of the individual limits may be omitted. A range @code{[:]} |
|
45 indicates that the default limits should be used. This normally means |
|
46 that a range just large enough to include all the data points will be |
|
47 used. |
|
48 |
|
49 The expression to be plotted must not contain any literal matrices |
|
50 (e.g. @code{[ 1, 2; 3, 4 ]}) since it is nearly impossible to |
|
51 distinguish a plot range from a matrix of data. |
|
52 |
|
53 See the help for @code{gnuplot} for a description of the syntax for the |
|
54 optional items. |
|
55 |
|
56 By default, the @code{gplot} command plots the second column of a matrix |
|
57 versus the first. If the matrix only has one column, it is taken as a |
|
58 vector of y-coordinates and the x-coordinate is taken as the element |
|
59 index, starting with zero. For example, |
|
60 |
|
61 @example |
|
62 gplot rand (100,1) with linespoints |
|
63 @end example |
|
64 |
|
65 @noindent |
|
66 will plot 100 random values and connect them with lines. When |
|
67 @code{gplot} is used to plot a column vector, the indices of the |
|
68 elements are taken as x values. |
|
69 |
|
70 If there are more than two columns, you can |
|
71 choose which columns to plot with the @var{using} qualifier. For |
|
72 example, given the data |
|
73 |
|
74 @example |
|
75 x = (-10:0.1:10)'; |
|
76 data = [x, sin(x), cos(x)]; |
|
77 @end example |
|
78 |
|
79 @noindent |
|
80 the command |
|
81 |
|
82 @example |
|
83 gplot [-11:11] [-1.1:1.1] data with lines, data using 1:3 with impulses |
|
84 @end example |
|
85 |
|
86 @noindent |
|
87 will plot two lines. The first line is generated by the command |
|
88 @code{data with lines}, and is a graph of the sine function over the |
|
89 range -10 to 10. The data is taken from the first two columns of the |
|
90 matrix because columns to plot were not specified with the @var{using} |
|
91 qualifier. |
|
92 |
|
93 The clause @code{using 1:3} in the second part of this plot command |
|
94 specifies that the first and third columns of the matrix @code{data} |
|
95 should be taken as the values to plot. |
|
96 |
|
97 In this example, the ranges have been explicitly specified to be a bit |
|
98 larger than the actual range of the data so that the curves do not touch |
|
99 the border of the plot. |
2449
|
100 @end deffn |
2333
|
101 |
2449
|
102 @deffn {Command} set options |
|
103 @deffnx {Command} show options |
|
104 @deffnx {Command} replot options |
2333
|
105 In addition to the basic plotting commands, the whole range of |
|
106 @code{set} and @code{show} commands from @code{gnuplot} are available, |
|
107 as is @code{replot}. |
|
108 |
|
109 The @code{set} and @code{show} commands allow you to set and show |
|
110 @code{gnuplot} parameters. For more information about the set and show |
|
111 commands, see the @code{gnuplot} user's guide (also available on line if |
|
112 you run @code{gnuplot} directly, instead of running it from Octave). |
|
113 |
|
114 The @code{replot} command allows you to force the plot to be |
|
115 redisplayed. This is useful if you have changed something about the |
|
116 plot, such as the title or axis labels. The @code{replot} command also |
|
117 accepts the same arguments as @code{gplot} or @code{gsplot} (except for |
|
118 data ranges) so you can add additional lines to existing plots. |
|
119 |
|
120 For example, |
|
121 |
|
122 @example |
|
123 set term tek40 |
|
124 set output "/dev/plotter" |
|
125 set title "sine with lines and cosine with impulses" |
|
126 replot "sin (x) w l" |
|
127 @end example |
|
128 |
|
129 will change the terminal type for plotting, add a title to the current |
|
130 plot, add a graph of sin (x) to the plot, and force the new plot to be |
|
131 sent to the plot device. This last step is normally required in order |
|
132 to update the plot. This default is reasonable for slow terminals or |
|
133 hardcopy output devices because even when you are adding additional |
|
134 lines with a replot command, gnuplot always redraws the entire plot, and |
|
135 you probably don't want to have a completely new plot generated every |
|
136 time something as minor as an axis label changes. |
2449
|
137 @end deffn |
2333
|
138 |
2449
|
139 @defvr {Built-in Variable} automatic_replot |
|
140 You can tell Octave to redisplay the plot each time anything about it |
|
141 changes by setting the value of the builtin variable |
|
142 @code{automatic_replot} to a nonzero value. Since this is fairly |
|
143 inefficient, the default value is 0. |
|
144 @end defvr |
2333
|
145 |
|
146 Note that NaN values in the plot data are automatically omitted, and |
|
147 Inf values are converted to a very large value before calling gnuplot. |
|
148 |
|
149 @c XXX FIXME XXX -- add info about what to do to get plots on remote X |
|
150 @c terminals. People often forget how to properly set DISPLAY and run |
|
151 @c xhost. |
|
152 |
|
153 @c XXX FIXME XXX -- add info about getting paper copies of plots. |
|
154 |
|
155 The @sc{Matlab}-style two-dimensional plotting commands are: |
|
156 |
|
157 @cindex plotting |
|
158 @cindex graphics |
|
159 |
2449
|
160 @deftypefn {Function File} {} plot (@var{args}) |
2333
|
161 This function produces two-dimensional plots. Many different |
|
162 combinations of arguments are possible. The simplest form is |
|
163 |
|
164 @example |
|
165 plot (y) |
|
166 @end example |
|
167 |
|
168 @noindent |
|
169 where the argument is taken as the set of @var{y} coordinates and the |
|
170 @var{x} coordinates are taken to be the indices of the elements, |
|
171 starting with 1. |
|
172 |
|
173 If more than one argument is given, they are interpreted as |
|
174 |
|
175 @example |
|
176 plot (x [, y] [, fmt] ...) |
|
177 @end example |
|
178 |
|
179 @noindent |
|
180 where @var{y} and @var{fmt} are optional, and any number of argument |
|
181 sets may appear. The @var{x} and @var{y} values are |
|
182 interpreted as follows: |
|
183 |
|
184 @itemize @bullet |
|
185 @item |
|
186 If a single data argument is supplied, it is taken as the set of @var{y} |
|
187 coordinates and the @var{x} coordinates are taken to be the indices of |
|
188 the elements, starting with 1. |
|
189 |
|
190 @item |
|
191 If the first argument is a vector and the second is a matrix, the |
|
192 the vector is plotted versus the columns (or rows) of the matrix. |
|
193 (using whichever combination matches, with columns tried first.) |
|
194 |
|
195 @item |
|
196 If the first argument is a matrix and the second is a vector, the |
|
197 the columns (or rows) of the matrix are plotted versus the vector. |
|
198 (using whichever combination matches, with columns tried first.) |
|
199 |
|
200 @item |
|
201 If both arguments are vectors, the elements of @var{y} are plotted versus |
|
202 the elements of @var{x}. |
|
203 |
|
204 @item |
|
205 If both arguments are matrices, the columns of @var{y} are plotted |
|
206 versus the columns of @var{x}. In this case, both matrices must have |
|
207 the same number of rows and columns and no attempt is made to transpose |
|
208 the arguments to make the number of rows match. |
|
209 |
|
210 If both arguments are scalars, a single point is plotted. |
|
211 @end itemize |
|
212 |
|
213 The @var{fmt} argument, if present is interpreted as follows. If |
|
214 @var{fmt} is missing, the default gnuplot line style is assumed. |
|
215 |
|
216 @table @asis |
|
217 @item @samp{-} |
|
218 Set lines plot style (default). |
|
219 |
|
220 @item @samp{.} |
|
221 Set dots plot style. |
|
222 |
|
223 @item @samp{@@} |
|
224 Set points plot style. |
|
225 |
|
226 @item @samp{-@@} |
|
227 Set linespoints plot style. |
|
228 |
|
229 @item @samp{^} |
|
230 Set impulses plot style. |
|
231 |
|
232 @item @samp{L} |
|
233 Set steps plot style. |
|
234 |
|
235 @item @samp{#} |
|
236 Set boxes plot style. |
|
237 |
|
238 @item @samp{~} |
|
239 Set errorbars plot style. |
|
240 |
|
241 @item @samp{#~} |
|
242 Set boxerrorbars plot style. |
|
243 |
|
244 @item @samp{n} |
|
245 Interpreted as the plot color if @var{n} is an integer in the range 1 to |
|
246 6. |
|
247 |
|
248 @item @samp{nm} |
|
249 If @var{nm} is a two digit integer and @var{m} is an integer in the |
|
250 range 1 to 6, @var{m} is interpreted as the point style. This is only |
|
251 valid in combination with the @code{@@} or @code{-@@} specifiers. |
|
252 |
|
253 @item @samp{c} |
|
254 If @var{c} is one of @var{"r"}, @var{"g"}, @var{"b"}, @var{"m"}, |
|
255 @var{"c"}, or @var{"w"}, it is interpreted as the plot color (red, |
|
256 green, blue, magenta, cyan, or white). |
|
257 |
|
258 @item @samp{+} |
|
259 @itemx @samp{*} |
|
260 @itemx @samp{o} |
|
261 @itemx @samp{x} |
|
262 Used in combination with the points or linespoints styles, set the point |
|
263 style. |
|
264 @end table |
|
265 |
|
266 The color line styles have the following meanings on terminals that |
|
267 support color. |
|
268 |
|
269 @example |
|
270 Number Gnuplot colors (lines)points style |
|
271 1 red * |
|
272 2 green + |
|
273 3 blue o |
|
274 4 magenta x |
|
275 5 cyan house |
|
276 6 brown there exists |
|
277 @end example |
|
278 |
|
279 Here are some plot examples: |
|
280 |
|
281 @example |
|
282 plot (x, y, "@@12", x, y2, x, y3, "4", x, y4, "+") |
|
283 @end example |
|
284 |
|
285 This command will plot @var{y} with points of type 2 (displayed as |
|
286 @code{+}) and color 1 (red), @var{y2} with lines, @var{y3} with lines of |
|
287 color 4 (magenta) and @var{y4} with points displayed as @code{+}. |
|
288 |
|
289 @example |
|
290 plot (b, "*") |
|
291 @end example |
|
292 |
|
293 This command will plot the data in @var{b} will be plotted with points |
|
294 displayed as @code{*}. |
2449
|
295 @end deftypefn |
2333
|
296 |
2449
|
297 @deftypefn {Function File} {} hold @var{args} |
2333
|
298 Tell Octave to `hold' the current data on the plot when executing |
|
299 subsequent plotting commands. This allows you to execute a series of |
|
300 plot commands and have all the lines end up on the same figure. The |
|
301 default is for each new plot command to clear the plot device first. |
|
302 For example, the command |
|
303 |
|
304 @example |
|
305 hold on |
|
306 @end example |
|
307 |
|
308 @noindent |
|
309 turns the hold state on. An argument of @code{off} turns the hold state |
|
310 off, and @code{hold} with no arguments toggles the current hold state. |
2449
|
311 @end deftypefn |
2333
|
312 |
2449
|
313 @deftypefn {Function File} {} ishold |
2333
|
314 Returns 1 if the next line will be added to the current plot, or 0 if |
|
315 the plot device will be cleared before drawing the next line. |
2449
|
316 @end deftypefn |
2333
|
317 |
2449
|
318 @deftypefn {Function File} {} loglog (@var{args}) |
2333
|
319 Make a two-dimensional plot using log scales for both axes. See the |
|
320 description of @code{plot} above for a description of the arguments that |
|
321 @code{loglog} will accept. |
2449
|
322 @end deftypefn |
2333
|
323 |
2449
|
324 @deftypefn {Function File} {} semilogx (@var{args}) |
2333
|
325 Make a two-dimensional plot using a log scale for the @var{x} axis. See |
|
326 the description of @code{plot} above for a description of the arguments |
|
327 that @code{semilogx} will accept. |
2449
|
328 @end deftypefn |
2333
|
329 |
2449
|
330 @deftypefn {Function File} {} semilogy (@var{args}) |
2333
|
331 Make a two-dimensional plot using a log scale for the @var{y} axis. See |
|
332 the description of @code{plot} above for a description of the arguments |
|
333 that @code{semilogy} will accept. |
2449
|
334 @end deftypefn |
2333
|
335 |
2449
|
336 @deftypefn {Function File} {} contour (@var{z}, @var{n}, @var{x}, @var{y}) |
2333
|
337 Make a contour plot of the three-dimensional surface described by |
|
338 @var{z}. Someone needs to improve @code{gnuplot}'s contour routines |
|
339 before this will be very useful. |
2449
|
340 @end deftypefn |
2333
|
341 |
2449
|
342 @deftypefn {Function File} {} polar (@var{theta}, @var{rho}) |
2333
|
343 Make a two-dimensional plot given polar the coordinates @var{theta} and |
|
344 @var{rho}. |
2449
|
345 @end deftypefn |
2333
|
346 |
|
347 @node Three-Dimensional Plotting, Miscellaneous Plotting Functions, Two-Dimensional Plotting, Plotting |
|
348 @section Three-Dimensional Plotting |
|
349 |
2449
|
350 @deffn {Command} gsplot @var{ranges} @var{expression} @var{using} @var{title} @var{style} |
|
351 Generate a 3-dimensional plot. |
2333
|
352 |
2449
|
353 The @var{ranges}, @var{using}, @var{title}, and @var{style} arguments |
|
354 are optional, and the @var{using}, @var{title} and @var{style} |
2333
|
355 qualifiers may appear in any order after the expression. You may plot |
|
356 multiple expressions with a single command by separating them with |
|
357 commas. Each expression may have its own set of qualifiers. |
|
358 |
|
359 The optional item @var{ranges} has the syntax |
|
360 |
|
361 @example |
|
362 [ x_lo : x_up ] [ y_lo : y_up ] [ z_lo : z_up ] |
|
363 @end example |
|
364 |
|
365 @noindent |
|
366 and may be used to specify the ranges for the axes of the plot, |
|
367 independent of the actual range of the data. The range for the y and z |
|
368 axes and any of the individual limits may be omitted. A range |
|
369 @code{[:]} indicates that the default limits should be used. This |
|
370 normally means that a range just large enough to include all the data |
|
371 points will be used. |
|
372 |
|
373 The expression to be plotted must not contain any literal matrices (e.g. |
|
374 @code{[ 1, 2; 3, 4 ]}) since it is nearly impossible to distinguish a |
|
375 plot range from a matrix of data. |
|
376 |
|
377 See the help for @code{gnuplot} for a description of the syntax for the |
|
378 optional items. |
|
379 |
|
380 By default, the @code{gsplot} command plots each column of the |
|
381 expression as the z value, using the row index as the x value, and the |
|
382 column index as the y value. The indices are counted from zero, not |
|
383 one. For example, |
|
384 |
|
385 @example |
|
386 gsplot rand (5, 2) |
|
387 @end example |
|
388 |
|
389 @noindent |
|
390 will plot a random surface, with the x and y values taken from the row |
|
391 and column indices of the matrix. |
|
392 |
|
393 If parametric plotting mode is set (using the command |
|
394 @samp{set parametric}, then @code{gsplot} takes the columns of the |
|
395 matrix three at a time as the x, y and z values that define a line in |
|
396 three space. Any extra columns are ignored, and the x and y values are |
|
397 expected to be sorted. For example, with @samp{parametric} set, it |
|
398 makes sense to plot a matrix like |
|
399 @iftex |
|
400 @tex |
|
401 $$ |
|
402 \left[\matrix{ |
|
403 1 & 1 & 3 & 2 & 1 & 6 & 3 & 1 & 9 \cr |
|
404 1 & 2 & 2 & 2 & 2 & 5 & 3 & 2 & 8 \cr |
|
405 1 & 3 & 1 & 2 & 3 & 4 & 3 & 3 & 7}\right] |
|
406 $$ |
|
407 @end tex |
|
408 @end iftex |
|
409 @ifinfo |
|
410 |
|
411 @example |
|
412 1 1 3 2 1 6 3 1 9 |
|
413 1 2 2 2 2 5 3 2 8 |
|
414 1 3 1 2 3 4 3 3 7 |
|
415 @end example |
|
416 @end ifinfo |
|
417 |
|
418 @noindent |
|
419 but not @code{rand (5, 30)}. |
2449
|
420 @end deffn |
2333
|
421 |
|
422 The @sc{Matlab}-style three-dimensional plotting commands are: |
|
423 |
2449
|
424 @deftypefn {Function File} {} mesh (@var{x}, @var{y}, @var{z}) |
2333
|
425 Plot a mesh given matrices @code{x}, and @var{y} from @code{meshdom} and |
|
426 a matrix @var{z} corresponding to the @var{x} and @var{y} coordinates of |
|
427 the mesh. |
2449
|
428 @end deftypefn |
2333
|
429 |
2449
|
430 @deftypefn {Function File} {} meshdom (@var{x}, @var{y}) |
2333
|
431 Given vectors of @var{x} and @var{y} coordinates, return two matrices |
|
432 corresponding to the @var{x} and @var{y} coordinates of the mesh. |
|
433 |
|
434 See the file @file{sombrero.m} for an example of using @code{mesh} and |
|
435 @code{meshdom}. |
2449
|
436 @end deftypefn |
|
437 |
|
438 @defvr {Built-in Variable} gnuplot_binary |
|
439 The name of the program invoked by the plot command. The default value |
|
440 is @code{"gnuplot"}. @xref{Installation}. |
|
441 @end defvr |
|
442 |
|
443 @defvr {Built-in Variable} gnuplot_has_frames |
|
444 If the value of this variable is nonzero, Octave assumes that your copy |
|
445 of gnuplot has support for multiple frames that is included in recent |
|
446 3.6beta releases. It's initial value is determined by configure, but it |
|
447 can be changed in your startup script or at the command line in case |
|
448 configure got it wrong, or if you upgrade your gnuplot installation. |
|
449 @end defvr |
|
450 |
|
451 @defvr {Built-in Variable} gnuplot_has_multiplot |
|
452 If the value of this variable is nonzero, Octave assumes that your copy |
|
453 of gnuplot has the multiplot support that is included in recent |
|
454 3.6beta releases. It's initial value is determined by configure, but it |
|
455 can be changed in your startup script or at the command line in case |
|
456 configure got it wrong, or if you upgrade your gnuplot installation. |
|
457 @end defvr |
2333
|
458 |
|
459 @node Miscellaneous Plotting Functions, , Three-Dimensional Plotting, Plotting |
|
460 @section Miscellaneous Plotting Functions |
|
461 |
2449
|
462 @deftypefn {Function File} {} bar (@var{x}, @var{y}) |
2333
|
463 Given two vectors of x-y data, @code{bar} produces a bar graph. |
|
464 |
|
465 If only one argument is given, it is taken as a vector of y-values |
|
466 and the x coordinates are taken to be the indices of the elements. |
|
467 |
|
468 If two output arguments are specified, the data are generated but |
|
469 not plotted. For example, |
|
470 |
|
471 @example |
|
472 bar (x, y); |
|
473 @end example |
|
474 |
|
475 @noindent |
|
476 and |
|
477 |
|
478 @example |
|
479 [xb, yb] = bar (x, y); |
|
480 plot (xb, yb); |
|
481 @end example |
|
482 |
|
483 @noindent |
|
484 are equivalent. |
2449
|
485 @end deftypefn |
2333
|
486 |
2449
|
487 @deftypefn {Function File} {} grid |
2333
|
488 For two-dimensional plotting, force the display of a grid on the plot. |
2449
|
489 @end deftypefn |
2333
|
490 |
2449
|
491 @deftypefn {Function File} {} stairs (@var{x}, @var{y}) |
2333
|
492 Given two vectors of x-y data, bar produces a `stairstep' plot. |
|
493 |
|
494 If only one argument is given, it is taken as a vector of y-values |
|
495 and the x coordinates are taken to be the indices of the elements. |
|
496 |
|
497 If two output arguments are specified, the data are generated but |
|
498 not plotted. For example, |
|
499 |
|
500 @example |
|
501 stairs (x, y); |
|
502 @end example |
|
503 |
|
504 @noindent |
|
505 and |
|
506 |
|
507 @example |
|
508 [xs, ys] = stairs (x, y); |
|
509 plot (xs, ys); |
|
510 @end example |
|
511 |
|
512 @noindent |
|
513 are equivalent. |
2449
|
514 @end deftypefn |
2333
|
515 |
2449
|
516 @deftypefn {Function File} {} title (@var{string}) |
2333
|
517 Specify a title for the plot. If you already have a plot displayed, use |
|
518 the command @code{replot} to redisplay it with the new title. |
2449
|
519 @end deftypefn |
2333
|
520 |
2449
|
521 @deftypefn {Function File} {} xlabel (@var{string}) |
|
522 @deftypefnx {Function File} {} ylabel (@var{string}) |
2333
|
523 Specify x and y axis labels for the plot. If you already have a plot |
|
524 displayed, use the command @code{replot} to redisplay it with the new |
|
525 labels. |
2449
|
526 @end deftypefn |
2333
|
527 |
2449
|
528 @deftypefn {Function File} {} sombrero (@var{n}) |
2333
|
529 Display a classic three-dimensional mesh plot. The parameter @var{n} |
|
530 allows you to increase the resolution. |
2449
|
531 @end deftypefn |
2333
|
532 |
2449
|
533 @deftypefn {Function File} {} clearplot |
|
534 @deftypefnx {Function File} {} clg |
2333
|
535 Clear the plot window and any titles or axis labels. The name |
|
536 @code{clg} is aliased to @code{clearplot} for compatibility with @sc{Matlab}. |
|
537 |
|
538 The commands @samp{gplot clear}, @samp{gsplot clear}, and @samp{replot |
|
539 clear} are equivalent to @samp{clearplot}. (Previously, commands like |
|
540 @samp{gplot clear} would evaluate @samp{clear} as an ordinary expression |
|
541 and clear all the visible variables.) |
2449
|
542 @end deftypefn |
2333
|
543 |
2449
|
544 @deftypefn {Function File} {} closeplot |
2333
|
545 Close stream to the @code{gnuplot} subprocess. If you are using X11, |
|
546 this will close the plot window. |
2449
|
547 @end deftypefn |
2333
|
548 |
2449
|
549 @deftypefn {Function File} {} purge_tmp_files |
2333
|
550 Delete the temporary files created by the plotting commands. |
|
551 |
|
552 Octave creates temporary data files for @code{gnuplot} and then sends |
|
553 commands to @code{gnuplot} through a pipe. Octave will delete the |
|
554 temporary files on exit, but if you are doing a lot of plotting you may |
|
555 want to clean up in the middle of a session. |
|
556 |
|
557 A future version of Octave will eliminate the need to use temporary |
|
558 files to hold the plot data. |
2449
|
559 @end deftypefn |
2333
|
560 |
2449
|
561 @deftypefn {Function File} {} axis (@var{limits}) |
2333
|
562 Sets the axis limits for plots. |
|
563 |
|
564 The argument @var{limits} should be a 2, 4, or 6 element vector. The |
|
565 first and second elements specify the lower and upper limits for the x |
|
566 axis. The third and fourth specify the limits for the y axis, and the |
|
567 fifth and sixth specify the limits for the z axis. |
|
568 |
|
569 With no arguments, @code{axis} turns autoscaling on. |
|
570 |
|
571 If your plot is already drawn, then you need to use @code{replot} before |
|
572 the new axis limits will take effect. You can get this to happen |
|
573 automatically by setting the built-in variable @code{automatic_replot} |
2449
|
574 to a nonzero value. |
|
575 @end deftypefn |
2333
|
576 |
2449
|
577 @deftypefn {Function File} {} hist (@var{y}, @var{x}) |
2333
|
578 Produce histogram counts or plots. |
|
579 |
|
580 With one vector input argument, plot a histogram of the values with |
|
581 10 bins. The range of the histogram bins is determined by the range |
|
582 of the data. |
|
583 |
|
584 Given a second scalar argument, use that as the number of bins. |
|
585 |
|
586 Given a second vector argument, use that as the centers of the bins, |
|
587 with the width of the bins determined from the adjacent values in |
|
588 the vector. |
|
589 |
|
590 Extreme values are lumped in the first and last bins. |
|
591 |
|
592 With two output arguments, produce the values @var{nn} and @var{xx} such |
|
593 that @code{bar (@var{xx}, @var{nn})} will plot the histogram. |
2449
|
594 @end deftypefn |