7018
|
1 @c Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, |
|
2 @c 2006, 2007 John W. Eaton |
|
3 @c |
|
4 @c This file is part of Octave. |
|
5 @c |
|
6 @c Octave is free software; you can redistribute it and/or modify it |
|
7 @c under the terms of the GNU General Public License as published by the |
|
8 @c Free Software Foundation; either version 3 of the License, or (at |
|
9 @c your option) any later version. |
|
10 @c |
|
11 @c Octave is distributed in the hope that it will be useful, but WITHOUT |
|
12 @c ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 @c FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 @c for more details. |
|
15 @c |
|
16 @c You should have received a copy of the GNU General Public License |
|
17 @c along with Octave; see the file COPYING. If not, see |
|
18 @c <http://www.gnu.org/licenses/>. |
3294
|
19 |
4167
|
20 @node Plotting |
3294
|
21 @chapter Plotting |
6888
|
22 @cindex plotting |
|
23 @cindex graphics |
3294
|
24 |
|
25 @menu |
6888
|
26 * Plotting Basics:: |
|
27 * Advanced Plotting:: |
|
28 @end menu |
|
29 |
|
30 @node Plotting Basics |
|
31 @section Plotting Basics |
|
32 |
|
33 Octave makes it easy to create many different types of two- and |
|
34 three-dimensional plots using a few high-level functions. |
|
35 |
|
36 If you need finer control over graphics, see @ref{Advanced Plotting}. |
|
37 |
|
38 @menu |
|
39 * Two-Dimensional Plots:: |
3294
|
40 * Three-Dimensional Plotting:: |
|
41 * Plot Annotations:: |
|
42 * Multiple Plots on One Page:: |
3428
|
43 * Multiple Plot Windows:: |
6888
|
44 * Printing Plots:: |
|
45 * Test Plotting Functions:: |
3294
|
46 @end menu |
|
47 |
6888
|
48 @node Two-Dimensional Plots |
|
49 @subsection Two-Dimensional Plots |
|
50 |
|
51 The @code{plot} function allows you to create simple x-y plots with |
|
52 linear axes. For example, |
3294
|
53 |
6888
|
54 @example |
|
55 @group |
|
56 x = -10:0.1:10; |
|
57 plot (x, sin (x)); |
|
58 @end group |
|
59 @end example |
|
60 |
|
61 @noindent |
6899
|
62 displays a sine wave shown in @ref{fig:plot}. On most systems, this |
6888
|
63 command will open a separate plot window to display the graph. |
5134
|
64 |
6888
|
65 @float Figure,fig:plot |
|
66 @image{plot,8cm} |
|
67 @caption{Simple Two-Dimensional Plot.} |
|
68 @end float |
|
69 |
|
70 The function @code{fplot} also generates two-dimensional plots with |
|
71 linear axes using a function name and limits for the range of the |
|
72 x-coordinate instead of the x and y data. For example, |
5134
|
73 |
6888
|
74 @example |
|
75 @group |
|
76 fplot (@@sin, [-10, 10], 201); |
|
77 @end group |
|
78 @end example |
|
79 |
|
80 @noindent |
|
81 produces a plot that is equivalent to the one above, but also includes a |
|
82 legend displaying the name of the plotted function. |
6502
|
83 |
5134
|
84 @DOCSTRING(plot) |
|
85 |
6502
|
86 @DOCSTRING(fplot) |
|
87 |
6888
|
88 The functions @code{semilogx}, @code{semilogy}, and @code{loglog} are |
|
89 similar to the @code{plot} function, but produce plots in which one or |
|
90 both of the axes use log scales. |
|
91 |
|
92 @DOCSTRING(semilogx) |
6502
|
93 |
6888
|
94 @DOCSTRING(semilogy) |
6502
|
95 |
6888
|
96 @DOCSTRING(loglog) |
|
97 |
|
98 The functions @code{bar}, @code{barh}, @code{stairs}, and @code{stem} |
|
99 are useful for displaying discrete data. For example, |
5134
|
100 |
6888
|
101 @example |
|
102 @group |
|
103 hist (randn (10000, 1), 30); |
|
104 @end group |
|
105 @end example |
5134
|
106 |
6888
|
107 @noindent |
|
108 produces the histogram of 10,000 normally distributed random numbers |
6899
|
109 shown in @ref{fig:hist}. |
5134
|
110 |
6888
|
111 @float Figure,fig:hist |
|
112 @image{hist,8cm} |
|
113 @caption{Histogram.} |
|
114 @end float |
5134
|
115 |
|
116 @DOCSTRING(bar) |
|
117 |
6877
|
118 @DOCSTRING(barh) |
|
119 |
6888
|
120 @DOCSTRING(hist) |
|
121 |
|
122 @DOCSTRING(stairs) |
|
123 |
|
124 @DOCSTRING(stem) |
|
125 |
|
126 The @code{contour} and @code{contourc} functions produce two-dimensional |
|
127 contour plots from three dimensional data. |
|
128 |
5134
|
129 @DOCSTRING(contour) |
|
130 |
6502
|
131 @DOCSTRING(contourc) |
|
132 |
6888
|
133 The @code{errorbar}, @code{semilogxerr}, @code{semilogyerr}, and |
|
134 @code{loglogerr} functions produces plots with error bar markers. For |
|
135 example, |
6877
|
136 |
6888
|
137 @example |
|
138 x = 0:0.1:10; |
|
139 y = sin (x); |
|
140 yp = 0.1 .* randn (size (x)); |
|
141 ym = -0.1 .* randn (size (x)); |
|
142 errorbar (x, sin (x), ym, yp); |
|
143 @end example |
5134
|
144 |
6888
|
145 @noindent |
6899
|
146 produces the figure shown in @ref{fig:errorbar}. |
6502
|
147 |
6888
|
148 @float Figure,fig:errorbar |
|
149 @image{errorbar,8cm} |
|
150 @caption{Errorbar plot.} |
|
151 @end float |
5134
|
152 |
|
153 @DOCSTRING(errorbar) |
|
154 |
|
155 @DOCSTRING(semilogxerr) |
|
156 |
|
157 @DOCSTRING(semilogyerr) |
|
158 |
6888
|
159 @DOCSTRING(loglogerr) |
|
160 |
|
161 Finally, the @code{polar} function allows you to easily plot data in |
7001
|
162 polar coordinates. However, the display coordinates remain rectangular |
6888
|
163 and linear. For example, |
|
164 |
|
165 @example |
|
166 polar (0:0.1:10*pi, 0:0.1:10*pi); |
|
167 @end example |
|
168 |
|
169 @noindent |
6899
|
170 produces the spiral plot shown in @ref{fig:polar}. |
6888
|
171 |
|
172 @float Figure,fig:polar |
|
173 @image{polar,8cm} |
|
174 @caption{Polar plot.} |
|
175 @end float |
|
176 |
|
177 @DOCSTRING(polar) |
|
178 |
7120
|
179 @DOCSTRING(pie) |
|
180 |
|
181 @DOCSTRING(quiver) |
|
182 |
|
183 @DOCSTRING(pcolor) |
|
184 |
6888
|
185 The axis function may be used to change the axis limits of an existing |
|
186 plot. |
|
187 |
|
188 @DOCSTRING(axis) |
|
189 |
5134
|
190 @node Three-Dimensional Plotting |
6888
|
191 @subsection Three-Dimensional Plotting |
|
192 |
|
193 The function @code{mesh} produces mesh surface plots. For example, |
|
194 |
|
195 @example |
|
196 @group |
|
197 tx = ty = linspace (-8, 8, 41)'; |
|
198 [xx, yy] = meshgrid (tx, ty); |
|
199 r = sqrt (xx .^ 2 + yy .^ 2) + eps; |
|
200 tz = sin (r) ./ r; |
|
201 mesh (tx, ty, tz); |
|
202 @end group |
|
203 @end example |
|
204 |
|
205 @noindent |
6899
|
206 produces the familiar ``sombrero'' plot shown in @ref{fig:mesh}. Note |
6888
|
207 the use of the function @code{meshgrid} to create matrices of X and Y |
|
208 coordinates to use for plotting the Z data. The @code{ndgrid} function |
|
209 is similar to @code{meshgrid}, but works for N-dimensional matrices. |
|
210 |
|
211 @float Figure,fig:mesh |
|
212 @image{mesh,8cm} |
|
213 @caption{Mesh plot.} |
|
214 @end float |
5134
|
215 |
6888
|
216 The @code{meshc} function is similar to @code{mesh}, but also produces a |
|
217 plot of contours for the surface. |
|
218 |
|
219 The @code{plot3} function displays arbitrary three-dimensional data, |
|
220 without requiring it to form a surface. For example |
|
221 |
|
222 @example |
|
223 @group |
|
224 t = 0:0.1:10*pi; |
|
225 r = linspace (0, 1, numel (t)); |
|
226 z = linspace (0, 1, numel (t)); |
|
227 plot3 (r.*sin(t), r.*cos(t), z); |
|
228 @end group |
|
229 @end example |
|
230 |
|
231 @noindent |
6899
|
232 displays the spiral in three dimensions shown in @ref{fig:plot3}. |
6888
|
233 |
|
234 @float Figure,fig:plot3 |
|
235 @image{plot3,8cm} |
|
236 @caption{Three dimensional spiral.} |
|
237 @end float |
|
238 |
|
239 Finally, the @code{view} function changes the viewpoint for |
|
240 three-dimensional plots. |
5134
|
241 |
|
242 @DOCSTRING(mesh) |
|
243 |
6788
|
244 @DOCSTRING(meshc) |
|
245 |
7120
|
246 @DOCSTRING(surf) |
|
247 |
|
248 @DOCSTRING(surfc) |
|
249 |
5134
|
250 @DOCSTRING(meshgrid) |
|
251 |
6550
|
252 @DOCSTRING(ndgrid) |
|
253 |
6888
|
254 @DOCSTRING(plot3) |
|
255 |
6502
|
256 @DOCSTRING(view) |
|
257 |
7120
|
258 @DOCSTRING(shading) |
|
259 |
6888
|
260 @node Plot Annotations |
|
261 @subsection Plot Annotations |
6502
|
262 |
6888
|
263 You can add titles, axis labels, legends, and arbitrary text to an |
|
264 existing plot. For example, |
6877
|
265 |
6888
|
266 @example |
|
267 @group |
|
268 x = -10:0.1:10; |
|
269 plot (x, sin (x)); |
|
270 title ("sin(x) for x = -10:0.1:10"); |
|
271 xlabel ("x"); |
|
272 ylabel ("sin (x)"); |
|
273 text (pi, 0.7, "arbitrary text"); |
|
274 legend ("sin (x)"); |
|
275 @end group |
|
276 @end example |
6502
|
277 |
6888
|
278 The functions @code{grid} and @code{box} may also be used to add grid |
|
279 and border lines to the plot. By default, the grid is off and the |
|
280 border lines are on. |
5134
|
281 |
|
282 @DOCSTRING(title) |
|
283 |
6502
|
284 @DOCSTRING(legend) |
|
285 |
|
286 @DOCSTRING(text) |
|
287 |
5134
|
288 @DOCSTRING(xlabel) |
|
289 |
6502
|
290 @DOCSTRING(box) |
|
291 |
|
292 @DOCSTRING(grid) |
|
293 |
5134
|
294 @node Multiple Plots on One Page |
6888
|
295 @subsection Multiple Plots on One Page |
|
296 |
|
297 Octave can display more than one plot in a single figure. The simplest |
|
298 way to do this is to use the @code{subplot} function to divide the plot |
|
299 area into a series of subplot windows that are indexed by an integer. |
|
300 For example, |
|
301 |
|
302 @example |
|
303 @group |
|
304 subplot (2, 1, 1) |
|
305 fplot (@@sin, [-10, 10]); |
|
306 subplot (2, 1, 2) |
|
307 fplot (@@cos, [-10, 10]); |
|
308 @end group |
|
309 @end example |
|
310 |
|
311 @noindent |
|
312 creates a figure with two separate axes, one displaying a sine wave and |
|
313 the other a cosine wave. The first call to subplot divides the figure |
|
314 into two plotting areas (two rows and one column) and makes the first plot |
|
315 area active. The grid of plot areas created by @code{subplot} is |
|
316 numbered in column-major order (top to bottom, left to right). |
5134
|
317 |
|
318 @DOCSTRING(subplot) |
|
319 |
|
320 @node Multiple Plot Windows |
6888
|
321 @subsection Multiple Plot Windows |
|
322 |
|
323 You can open multiple plot windows using the @code{figure} function. |
|
324 For example |
|
325 |
|
326 @example |
|
327 figure (1); |
|
328 fplot (@@sin, [-10, 10]); |
|
329 figure (2); |
|
330 fplot (@@cos, [-10, 10]); |
|
331 @end example |
|
332 |
|
333 @noindent |
|
334 creates two figures, with the first displaying a sine wave and |
|
335 the second a cosine wave. Figure numbers must be positive integers. |
5134
|
336 |
|
337 @DOCSTRING(figure) |
|
338 |
6502
|
339 @node Printing Plots |
6888
|
340 @subsection Printing Plots |
|
341 |
|
342 The @code{print} command allows you to save plots in a variety of |
|
343 formats. For example, |
|
344 |
|
345 @example |
|
346 print -deps foo.eps |
|
347 @end example |
|
348 |
|
349 @noindent |
|
350 writes the current figure to an encapsulated PostScript file called |
|
351 @file{foo.eps}. |
6502
|
352 |
|
353 @DOCSTRING(print) |
|
354 |
|
355 @DOCSTRING(orient) |
5134
|
356 |
6788
|
357 @node Test Plotting Functions |
6888
|
358 @subsection Test Plotting Functions |
|
359 |
|
360 The functions @code{sombrero} and @code{peaks} provide a way to check |
|
361 that plotting is working. Typing either @code{sombrero} or @code{peaks} |
|
362 at the Octave prompt should display a three dimensional plot. |
6788
|
363 |
6877
|
364 @DOCSTRING(sombrero) |
|
365 |
6788
|
366 @DOCSTRING(peaks) |
|
367 |
6888
|
368 @node Advanced Plotting |
|
369 @section Advanced Plotting |
|
370 |
|
371 @menu |
|
372 * Graphics Objects:: |
|
373 * Graphics Object Properties:: |
6891
|
374 * Managing Default Properties:: |
6889
|
375 * Colors:: |
|
376 * Line Styles:: |
|
377 * Marker Styles:: |
6888
|
378 * Interaction with gnuplot:: |
|
379 @end menu |
|
380 |
|
381 @node Graphics Objects |
|
382 @subsection Graphics Objects |
|
383 |
|
384 Plots in Octave are constructed from the following @dfn{graphics |
|
385 objects}. Each graphics object has a set of properties that define its |
|
386 appearance and may also contain links to other graphics objects. |
|
387 Graphics objects are only referenced by a numeric index, or @dfn{handle}. |
|
388 |
|
389 @table @asis |
|
390 @item root figure |
|
391 The parent of all figure objects. The index for the root figure is |
|
392 defined to be 0. |
|
393 |
|
394 @item figure |
|
395 A figure window. |
|
396 |
|
397 @item axes |
|
398 An set of axes. This object is a child of a figure object and may be a |
|
399 parent of line, text, image, patch, or surface objects. |
|
400 |
|
401 @item line |
|
402 A line in two or three dimensions. |
|
403 |
|
404 @item text |
|
405 Text annotations. |
|
406 |
|
407 @item image |
|
408 A bitmap image. |
|
409 |
|
410 @item patch |
|
411 A filled polygon, currently limited to two dimensions. |
|
412 |
|
413 @item surface |
|
414 A three-dimensional surface. |
|
415 @end table |
|
416 |
|
417 To determine whether an object is a graphics object index or a figure |
|
418 index, use the functions @code{ishandle} and @code{isfigure}. |
|
419 |
|
420 @DOCSTRING(ishandle) |
|
421 |
|
422 @DOCSTRING(isfigure) |
|
423 |
|
424 The function @code{gcf} returns an index to the current figure object, |
|
425 or creates one if none exists. Similarly, @code{gca} returns the |
|
426 current axes object, or creates one (and its parent figure object) if |
|
427 none exists. |
|
428 |
|
429 @DOCSTRING(gcf) |
|
430 |
|
431 @DOCSTRING(gca) |
|
432 |
|
433 The @code{get} and @code{set} functions may be used to examine and set |
|
434 properties for graphics objects. For example, |
|
435 |
|
436 @example |
|
437 @group |
|
438 get (0) |
|
439 @result{} ans = |
|
440 @{ |
|
441 type = root figure |
|
442 currentfigure = [](0x0) |
|
443 children = [](0x0) |
|
444 visible = on |
|
445 @} |
|
446 @end group |
|
447 @end example |
|
448 |
|
449 @noindent |
|
450 returns a structure containing all the properties of the root figure. |
|
451 As with all functions in Octave, the structure is returned by value, so |
|
452 modifying it will not modify the internal root figure plot object. To |
|
453 do that, you must use the @code{set} function. Also, note that in this |
|
454 case, the @code{currentfigure} property is empty, which indicates that |
|
455 there is no current figure window. |
|
456 |
|
457 The @code{get} function may also be used to find the value of a single |
|
458 property. For example, |
|
459 |
|
460 @example |
|
461 @group |
|
462 get (gca (), "xlim") |
|
463 @result{} [ 0 1 ] |
|
464 @end group |
|
465 @end example |
|
466 |
|
467 @noindent |
|
468 returns the range of the x-axis for the current axes object in the |
|
469 current figure. |
|
470 |
|
471 To set graphics object properties, use the set function. For example, |
|
472 |
|
473 @example |
|
474 set (gca (), "xlim", [-10, 10]); |
|
475 @end example |
|
476 |
|
477 @noindent |
|
478 sets the range of the x-axis for the current axes object in the current |
|
479 figure to @samp{[-10, 10]}. Additionally, calling set with a graphics |
|
480 object index as the only argument returns a structure containing the |
|
481 default values for all the properties for the given object type. For |
|
482 example, |
|
483 |
|
484 @example |
|
485 set (gca ()) |
|
486 @end example |
|
487 |
|
488 @noindent |
|
489 returns a structure containing the default property values for axes |
|
490 objects. |
|
491 |
|
492 @DOCSTRING(get) |
|
493 |
|
494 @DOCSTRING(set) |
|
495 |
|
496 @DOCSTRING(ancestor) |
|
497 |
|
498 You can create axes, line, and patch objects directly using the |
|
499 @code{axes}, @code{line}, and @code{patch} functions. These objects |
|
500 become children of the current axes object. |
|
501 |
|
502 @DOCSTRING(axes) |
|
503 |
|
504 @DOCSTRING(line) |
|
505 |
|
506 @DOCSTRING(patch) |
|
507 |
7120
|
508 @DOCSTRING(surface) |
|
509 |
6888
|
510 By default, Octave refreshes the plot window when a prompt is printed, |
|
511 or when waiting for input. To force an update at other times, call the |
|
512 @code{drawnow} function. |
|
513 |
|
514 @DOCSTRING(drawnow) |
|
515 |
|
516 Normally, high-level plot functions like @code{plot} or @code{mesh} call |
|
517 @code{newplot} to initialize the state of the current axes so that the |
|
518 next plot is drawn in a blank window with default property settings. To |
|
519 have two plots superimposed over one another, call the @code{hold} |
|
520 function. For example, |
|
521 |
|
522 @example |
|
523 @group |
|
524 hold ("on"); |
|
525 x = -10:0.1:10; |
|
526 plot (x, sin (x)); |
|
527 plot (x, cos (x)); |
|
528 hold ("off"); |
|
529 @end group |
|
530 @end example |
|
531 |
|
532 @noindent |
|
533 displays sine and cosine waves on the same axes. If the hold state is |
|
534 off, consecutive plotting commands like this will only display the last |
|
535 plot. |
|
536 |
|
537 @DOCSTRING(newplot) |
|
538 |
|
539 @DOCSTRING(hold) |
|
540 |
|
541 @DOCSTRING(ishold) |
|
542 |
|
543 To clear the current figure, call the @code{clf} function. To bring it |
|
544 to the top of the window stack, call the @code{shg} function. To delete |
|
545 a graphics object, call @code{delete} on its index. To close the |
|
546 figure window, call the @code{close} function. |
|
547 |
|
548 @DOCSTRING(clf) |
|
549 |
|
550 @DOCSTRING(shg) |
|
551 |
|
552 @DOCSTRING(delete) |
|
553 |
|
554 @DOCSTRING(close) |
|
555 |
|
556 @DOCSTRING(closereq) |
|
557 |
|
558 @node Graphics Object Properties |
|
559 @subsection Graphics Object Properties |
|
560 @cindex graphics object properties |
|
561 |
|
562 @menu |
|
563 * Root Figure Properties:: |
6889
|
564 * Figure Properties:: |
6888
|
565 * Axes Properties:: |
|
566 * Line Properties:: |
|
567 * Text Properties:: |
|
568 * Image Properties:: |
|
569 * Patch Properties:: |
|
570 * Surface Properties:: |
|
571 @end menu |
|
572 |
|
573 @node Root Figure Properties |
|
574 @subsubsection Root Figure Properties |
|
575 |
|
576 @table @code |
|
577 @item currentfigure |
6889
|
578 Index to graphics object for the current figure. |
|
579 |
|
580 @c FIXME -- does this work? |
|
581 @c @item visible |
|
582 @c Either @code{"on"} or @code{"off"} to toggle display of figures. |
6888
|
583 @end table |
|
584 |
6889
|
585 @node Figure Properties |
|
586 @subsubsection Figure Properties |
6888
|
587 |
|
588 @table @code |
|
589 @item nextplot |
6889
|
590 May be one of |
|
591 @table @code |
|
592 @item "new" |
|
593 @item "add" |
|
594 @item "replace" |
|
595 @item "replacechildren" |
|
596 @end table |
|
597 |
6888
|
598 @item closerequestfcn |
6889
|
599 Handle of function to call when a figure is closed. |
|
600 |
6888
|
601 @item currentaxes |
6889
|
602 Index to graphics object of current axes. |
|
603 |
6888
|
604 @item colormap |
6889
|
605 An N-by-3 matrix containing the color map for the current axes. |
|
606 |
6888
|
607 @item visible |
6889
|
608 Either @code{"on"} or @code{"off"} to toggle display of the figure. |
|
609 |
6888
|
610 @item paperorientation |
6889
|
611 Indicates the orientation for printing. Either @code{"landscape"} or |
|
612 @code{"portrait"}. |
6888
|
613 @end table |
|
614 |
|
615 @node Axes Properties |
|
616 @subsubsection Axes Properties |
|
617 |
|
618 @table @code |
|
619 @item position |
6889
|
620 A four-element vector specifying the coordinates of the lower left |
|
621 corner and width and height of the plot, in normalized units. For |
|
622 example, @code{[0.2, 0.3, 0.4, 0.5]} sets the lower left corner of the |
7001
|
623 axes at @math{(0.2, 0.3)} and the width and height to be 0.4 and 0.5 |
6889
|
624 respectively. |
|
625 |
6888
|
626 @item title |
6889
|
627 Index of text object for the axes title. |
|
628 |
6888
|
629 @item box |
6889
|
630 Either @code{"on"} or @code{"off"} to toggle display of the box around |
|
631 the axes. |
|
632 |
6888
|
633 @item key |
6889
|
634 Either @code{"on"} or @code{"off"} to toggle display of the legend. |
|
635 Note that this property is not compatible with @sc{Matlab} and may be |
|
636 removed in a future version of Octave. |
|
637 |
6888
|
638 @item keybox |
6889
|
639 Either @code{"on"} or @code{"off"} to toggle display of a box around the |
|
640 legend. Note that this property is not compatible with @sc{Matlab} and |
|
641 may be removed in a future version of Octave. |
|
642 |
6888
|
643 @item keypos |
6889
|
644 An integer from 1 to 4 specifying the position of the legend. 1 |
|
645 indicates upper right corner, 2 indicates upper left, 3 indicates lower |
|
646 left, and 4 indicates lower right. Note that this property is not |
|
647 compatible with @sc{Matlab} and may be removed in a future version of |
|
648 Octave. |
|
649 |
6888
|
650 @item dataaspectratio |
6889
|
651 A two-element vector specifying the relative height and width of the |
|
652 data displayed in the axes. Setting @code{dataaspectratio} to @samp{1, |
|
653 2]} causes the length of one unit as displayed on the y axis to be the |
|
654 same as the length of 2 units on the x axis. Setting |
|
655 @code{dataaspectratio} also forces the @code{dataaspectratiomode} |
|
656 property to be set to @code{"manual"}. |
|
657 |
6888
|
658 @item dataaspectratiomode |
6889
|
659 Either @code{"manual"} or @code{"auto"}. |
|
660 |
6888
|
661 @item xlim |
|
662 @itemx ylim |
|
663 @itemx zlim |
|
664 @itemx clim |
6889
|
665 Two-element vectors defining the limits for the x, y, and z axes and the |
|
666 Setting one of these properties also forces the corresponding mode |
|
667 property to be set to @code{"manual"}. |
|
668 |
6888
|
669 @item xlimmode |
|
670 @itemx ylimmode |
|
671 @itemx zlimmode |
|
672 @itemx climmode |
6889
|
673 Either @code{"manual"} or @code{"auto"}. |
|
674 |
6888
|
675 @item xlabel |
|
676 @itemx ylabel |
|
677 @itemx zlabel |
6889
|
678 Indices to text objects for the axes labels. |
|
679 |
6888
|
680 @item xgrid |
|
681 @itemx ygrid |
|
682 @itemx zgrid |
6889
|
683 Either @code{"on"} or @code{"off"} to toggle display of grid lines. |
|
684 |
6888
|
685 @item xminorgrid |
|
686 @itemx yminorgrid |
|
687 @itemx zminorgrid |
6889
|
688 Either @code{"on"} or @code{"off"} to toggle display of minor grid lines. |
|
689 |
6888
|
690 @item xtick |
|
691 @itemx ytick |
|
692 @itemx ztick |
6889
|
693 Setting one of these properties also forces the corresponding mode |
|
694 property to be set to @code{"manual"}. |
|
695 |
6888
|
696 @item xtickmode |
|
697 @itemx ytickmode |
|
698 @itemx ztickmode |
6889
|
699 Either @code{"manual"} or @code{"auto"}. |
|
700 |
6888
|
701 @item xticklabel |
|
702 @itemx yticklabel |
|
703 @itemx zticklabel |
6889
|
704 Setting one of these properties also forces the corresponding mode |
|
705 property to be set to @code{"manual"}. |
|
706 |
6888
|
707 @item xticklabelmode |
|
708 @itemx yticklabelmode |
|
709 @itemx zticklabelmode |
6889
|
710 Either @code{"manual"} or @code{"auto"}. |
|
711 |
6888
|
712 @item xscale |
|
713 @itemx yscale |
|
714 @itemx zscale |
6889
|
715 Either @code{"linear"} or @code{"log"}. |
|
716 |
6888
|
717 @item xdir |
|
718 @itemx ydir |
|
719 @itemx zdir |
6889
|
720 Either @code{"forward"} or @code{"reverse"}. |
|
721 |
6888
|
722 @item xaxislocation |
|
723 @itemx yaxislocation |
6889
|
724 Either @code{"top"} or @code{"bottom"} for the x axis and @code{"left"} |
|
725 or @code{"right"} for the y axis. |
|
726 |
6888
|
727 @item view |
6889
|
728 A three element vector specifying the view point for three-dimensional plots. |
|
729 |
6888
|
730 @item visible |
6889
|
731 Either @code{"on"} or @code{"off"} to toggle display of the axes. |
|
732 |
6888
|
733 @item nextplot |
6889
|
734 May be one of |
|
735 @table @code |
|
736 @item "new" |
|
737 @item "add" |
|
738 @item "replace" |
|
739 @item "replacechildren" |
|
740 @end table |
|
741 |
6888
|
742 @item outerposition |
6889
|
743 A four-element vector specifying the coordinates of the lower left |
|
744 corner and width and height of the plot, in normalized units. For |
|
745 example, @code{[0.2, 0.3, 0.4, 0.5]} sets the lower left corner of the |
7001
|
746 axes at @math{(0.2, 0.3)} and the width and height to be 0.4 and 0.5 |
6889
|
747 respectively. |
6888
|
748 @end table |
|
749 |
|
750 @node Line Properties |
|
751 @subsubsection Line Properties |
|
752 |
|
753 @table @code |
|
754 @itemx xdata |
|
755 @itemx ydata |
|
756 @itemx zdata |
|
757 @itemx ldata |
|
758 @itemx udata |
|
759 @itemx xldata |
|
760 @itemx xudata |
6889
|
761 The data to be plotted. The @code{ldata} and @code{udata} elements are |
|
762 for errobars in the y direction, and the @code{xldata} and @code{xudata} |
|
763 elements are for errorbars in the x direction. |
|
764 |
6888
|
765 @item color |
6889
|
766 The RGB color of the line, or a color name. @xref{Colors}. |
|
767 |
6888
|
768 @item linestyle |
6889
|
769 @itemx linewidth |
|
770 @xref{Line Styles}. |
|
771 |
6888
|
772 @item marker |
|
773 @item markeredgecolor |
|
774 @item markerfacecolor |
|
775 @item markersize |
6889
|
776 @xref{Marker Styles}. |
|
777 |
6888
|
778 @item keylabel |
6889
|
779 The text of the legend entry corresponding to this line. Note that this |
|
780 property is not compatible with @sc{Matlab} and may be removed in a |
|
781 future version of Octave. |
6888
|
782 @end table |
|
783 |
|
784 @node Text Properties |
|
785 @subsubsection Text Properties |
|
786 |
|
787 @table @code |
|
788 @item string |
6889
|
789 The character string contained by the text object. |
|
790 |
6888
|
791 @item units |
6889
|
792 May be @code{"normalized"} or @code{"graph"}. |
|
793 |
6888
|
794 @item position |
6889
|
795 The coordinates of the text object. |
|
796 |
6888
|
797 @item rotation |
6889
|
798 The angle of rotation for the displayed text, measured in degrees. |
|
799 |
6888
|
800 @item horizontalalignment |
6889
|
801 May be @code{"left"}, @code{"center"}, or @code{"right"}. |
|
802 |
6888
|
803 @item color |
6889
|
804 The color of the text. @xref{Colors}. |
6888
|
805 @end table |
|
806 |
|
807 @node Image Properties |
|
808 @subsubsection Image Properties |
|
809 |
|
810 @table @code |
|
811 @item cdata |
6889
|
812 The data for the image. Each pixel of the image corresponds to an |
|
813 element of @code{cdata}. The value of an element of @code{cdata} |
|
814 specifies the row-index into the colormap of the axes object containing |
|
815 the image. The color value found in the color map for the given index |
|
816 determines the color of the pixel. |
|
817 |
|
818 @item xdata |
6888
|
819 @itemx ydata |
7001
|
820 Two-element vectors specifying the range of the x- and y- coordinates for |
6889
|
821 the image. |
6888
|
822 @end table |
|
823 |
|
824 @node Patch Properties |
|
825 @subsubsection Patch Properties |
|
826 |
|
827 @table @code |
|
828 @item cdata |
|
829 @itemx xdata |
|
830 @itemx ydata |
|
831 @itemx zdata |
6889
|
832 Data defining the patch object. |
|
833 |
6888
|
834 @item facecolor |
6889
|
835 The fill color of the patch. @xref{Colors}. |
|
836 |
6888
|
837 @item facealpha |
6889
|
838 A number in the range [0, 1] indicating the transparency of the patch. |
|
839 |
6888
|
840 @item edgecolor |
6889
|
841 The color of the line defining the patch. @xref{Colors}. |
|
842 |
6888
|
843 @item linestyle |
6889
|
844 @itemx linewidth |
|
845 @xref{Line Styles}. |
|
846 |
6888
|
847 @item marker |
6889
|
848 @itemx markeredgecolor |
|
849 @itemx markerfacecolor |
|
850 @itemx markersize |
|
851 @xref{Marker Styles}. |
6888
|
852 @end table |
|
853 |
|
854 @node Surface Properties |
|
855 @subsubsection Surface Properties |
|
856 |
|
857 @table @code |
|
858 @item xdata |
|
859 @itemx ydata |
|
860 @itemx zdata |
6889
|
861 The data determining the surface. The @code{xdata} and @code{ydata} |
|
862 elements are vectors and @code{zdata} must be a matrix. |
|
863 |
6888
|
864 @item keylabel |
6889
|
865 The text of the legend entry corresponding to this surface. Note that |
|
866 this property is not compatible with @sc{Matlab} and may be removed in a |
|
867 future version of Octave. |
|
868 @end table |
|
869 |
6891
|
870 @node Managing Default Properties |
|
871 @subsection Managing Default Properties |
|
872 |
6892
|
873 Object properties have two classes of default values, @dfn{factory |
|
874 defaults} (the initial values) and @dfn{user-defined defaults}, which |
|
875 may override the factory defaults. |
6891
|
876 |
|
877 Although default values may be set for any object, they are set in |
|
878 parent objects and apply to child objects. For example, |
|
879 |
|
880 @example |
|
881 set (0, "defaultlinecolor", "green"); |
|
882 @end example |
|
883 |
|
884 @noindent |
|
885 sets the default line color for all objects. The rule for constructing |
|
886 the property name to set a default value is |
|
887 |
|
888 @example |
|
889 default + @var{object-type} + @var{property-name} |
|
890 @end example |
|
891 |
|
892 This rule can lead to some strange looking names, for example |
|
893 @code{defaultlinelinewidth"} specifies the default @code{linewidth} |
|
894 property for @code{line} objects. |
|
895 |
|
896 The example above used the root figure object, 0, so the default |
|
897 property value will apply to all line objects. However, default values |
|
898 are hierarchical, so defaults set in a figure objects override those |
|
899 set in the root figure object. Likewise, defaults set in axes objects |
|
900 override those set in figure or root figure objects. For example, |
|
901 |
|
902 @example |
|
903 @group |
|
904 subplot (2, 1, 1); |
|
905 set (0, "defaultlinecolor", "red"); |
|
906 set (1, "defaultlinecolor", "green"); |
|
907 set (gca (), "defaultlinecolor", "blue"); |
|
908 line (1:10, rand (1, 10)); |
|
909 subplot (2, 1, 2); |
|
910 line (1:10, rand (1, 10)); |
|
911 figure (2) |
|
912 line (1:10, rand (1, 10)); |
|
913 @end group |
|
914 @end example |
|
915 |
|
916 @noindent |
|
917 produces two figures. The line in first subplot window of the first |
|
918 figure is blue because it inherits its color from its parent axes |
|
919 object. The line in the second subplot window of the first figure is |
|
920 green because it inherits its color from its parent figure object. The |
|
921 line in the second figure window is red because it inherits its color |
|
922 from the global root figure parent object. |
|
923 |
|
924 To remove a user-defined default setting, set the default property to |
|
925 the value @code{"remove"}. For example, |
|
926 |
|
927 @example |
|
928 set (gca (), "defaultlinecolor", "remove"); |
|
929 @end example |
|
930 |
|
931 @noindent |
|
932 removes the user-defined default line color setting from the current axes |
|
933 object. |
|
934 |
|
935 Getting the @code{"default"} property of an object returns a list of |
|
936 user-defined defaults set for the object. For example, |
|
937 |
|
938 @example |
|
939 get (gca (), "default"); |
|
940 @end example |
|
941 |
|
942 @noindent |
|
943 returns a list of user-defined default values for the current axes |
|
944 object. |
|
945 |
|
946 Factory default values are stored in the root figure object. The |
|
947 command |
|
948 |
|
949 @example |
|
950 get (0, "factory"); |
|
951 @end example |
|
952 |
|
953 @noindent |
|
954 returns a list of factory defaults. |
|
955 |
6889
|
956 @node Colors |
|
957 @subsection Colors |
|
958 |
|
959 Colors may be specified as RGB triplets with values ranging from zero to |
|
960 one, or by name. Recognized color names include @code{"blue"}, |
|
961 @code{"black"}, @code{"cyan"}, @code{"green"}, @code{"magenta"}, |
|
962 @code{"red"}, @code{"white"}, and @code{"yellow"}. |
|
963 |
|
964 @node Line Styles |
|
965 @subsection Line Styles |
7001
|
966 Line styles are specified by the following properties: |
6889
|
967 |
|
968 @table @code |
|
969 @item linestyle |
|
970 May be one of |
|
971 @table @code |
|
972 @item "-" |
|
973 Solid lines. |
|
974 @item "--" |
|
975 Dashed lines. |
|
976 @item ":" |
|
977 Points. |
|
978 @item "-." |
|
979 A dash-dot line. |
|
980 @end table |
|
981 |
|
982 @item linewidth |
|
983 A number specifying the width of the line. The default is 1. A value |
|
984 of 2 is twice as wide as the default, etc. |
|
985 @end table |
|
986 |
|
987 @node Marker Styles |
|
988 @subsection Marker Styles |
7001
|
989 Marker styles are specified by the following properties: |
6889
|
990 @table @code |
|
991 @item marker |
|
992 A character indicating a plot marker to be place at each data point, or |
|
993 @code{"none"}, meaning no markers should be displayed. |
|
994 |
|
995 @itemx markeredgecolor |
|
996 The color of the edge around the marker, or @code{"auto"}, meaning that |
|
997 the edge color is the same as the face color. @xref{Colors}. |
|
998 |
|
999 @itemx markerfacecolor |
|
1000 The color of the marker, or @code{"none"} to indicate that the marker |
|
1001 should not be filled. @xref{Colors}. |
|
1002 |
|
1003 @itemx markersize |
|
1004 A number specifying the size of the marker. The default is 1. A value |
|
1005 of 2 is twice as large as the default, etc. |
6888
|
1006 @end table |
|
1007 |
4167
|
1008 @node Interaction with gnuplot |
6888
|
1009 @subsection Interaction with @code{gnuplot} |
3428
|
1010 |
|
1011 @DOCSTRING(gnuplot_binary) |
|
1012 |
6331
|
1013 @DOCSTRING(gnuplot_use_title_option) |