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