File: plot.texi

package info (click to toggle)
octave2.1 1%3A2.1.73-13
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 37,028 kB
  • ctags: 20,874
  • sloc: cpp: 106,508; fortran: 46,978; ansic: 5,720; sh: 4,800; makefile: 3,186; yacc: 3,132; lex: 2,892; lisp: 1,715; perl: 778; awk: 174; exp: 134
file content (1178 lines) | stat: -rw-r--r-- 35,097 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
@c DO NOT EDIT!  Generated automatically by munge-texi.

@c Copyright (C) 1996, 1997 John W. Eaton
@c This is part of the Octave manual.
@c For copying conditions, see the file gpl.texi.

@node Plotting
@chapter Plotting

All of Octave's plotting functions use @code{gnuplot} to handle the
actual graphics. Most types of plots can be generated using the basic
plotting functions, which are patterned after the equivalent functions
in @sc{Matlab}. The use of these functions is generally
straightforward, and is the preferred method for generating plots.
However, for users familiar with @code{gnuplot}, or for some
specialized applications where the basic commands are inadequate,
Octave also provides two low-level functions, @code{gplot} and
@code{gsplot}, that behave almost exactly like the corresponding
@code{gnuplot} functions @code{plot} and @code{splot}. Also note that
some advanced @sc{Matlab} features from recent versions are not
implemented, such as handle-graphics and related functions.

@menu
* Two-Dimensional Plotting::    
* Specialized Two-Dimensional Plots::  
* Three-Dimensional Plotting::  
* Plot Annotations::            
* Multiple Plots on One Page::  
* Multiple Plot Windows::       
@c *Exporting Plots::
* Low-Level plotting commands::
* Interaction with gnuplot::    
@end menu

@node Two-Dimensional Plotting
@section Two-Dimensional Plotting

The @sc{Matlab}-style two-dimensional plotting commands are:

@cindex plotting
@cindex graphics

@anchor{doc-plot}
@deftypefn {Function File} {} plot (@var{args})
This function produces two-dimensional plots.  Many different
combinations of arguments are possible.  The simplest form is

@example
plot (@var{y})
@end example

@noindent
where the argument is taken as the set of @var{y} coordinates and the
@var{x} coordinates are taken to be the indices of the elements,
starting with 1.

If more than one argument is given, they are interpreted as

@example
plot (@var{x}, @var{y}, @var{fmt} ...)
@end example

@noindent
where @var{y} and @var{fmt} are optional, and any number of argument
sets may appear.  The @var{x} and @var{y} values are
interpreted as follows:

@itemize @bullet
@item
If a single data argument is supplied, it is taken as the set of @var{y}
coordinates and the @var{x} coordinates are taken to be the indices of
the elements, starting with 1.

@item
If the first argument is a vector and the second is a matrix, the
the vector is plotted versus the columns (or rows) of the matrix.
(using whichever combination matches, with columns tried first.)

@item
If the first argument is a matrix and the second is a vector, the
the columns (or rows) of the matrix are plotted versus the vector.
(using whichever combination matches, with columns tried first.)

@item
If both arguments are vectors, the elements of @var{y} are plotted versus
the elements of @var{x}.

@item
If both arguments are matrices, the columns of @var{y} are plotted
versus the columns of @var{x}.  In this case, both matrices must have
the same number of rows and columns and no attempt is made to transpose
the arguments to make the number of rows match.

If both arguments are scalars, a single point is plotted.
@end itemize

If the @var{fmt} argument is supplied, it is interpreted as
follows.  If @var{fmt} is missing, the default gnuplot line style
is assumed.

@table @samp
@item -
Set lines plot style (default).

@item .
Set dots plot style.

@item @@
Set points plot style.

@item -@@
Set linespoints plot style.

@item ^
Set impulses plot style.

@item L
Set steps plot style.

@item @var{n}
Interpreted as the plot color if @var{n} is an integer in the range 1 to
6.

@item @var{nm}
If @var{nm} is a two digit integer and @var{m} is an integer in the
range 1 to 6, @var{m} is interpreted as the point style.  This is only
valid in combination with the @code{@@} or @code{-@@} specifiers.

@item @var{c}
If @var{c} is one of @code{"r"}, @code{"g"}, @code{"b"}, @code{"m"},
@code{"c"}, or @code{"w"}, it is interpreted as the plot color (red,
green, blue, magenta, cyan, or white).

@item ";title;"
Here @code{"title"} is the label for the key.

@item +
@itemx *
@itemx o
@itemx x
Used in combination with the points or linespoints styles, set the point
style.
@end table

The color line styles have the following meanings on terminals that
support color.

@example
Number  Gnuplot colors  (lines)points style
  1       red                   *
  2       green                 +
  3       blue                  o
  4       magenta               x
  5       cyan                house
  6       brown            there exists
@end example

The @var{fmt} argument can also be used to assign key titles.
To do so, include the desired title between semi-colons after the
formatting sequence described above, e.g. "+3;Key Title;"
Note that the last semi-colon is required and will generate an error if
it is left out.

Here are some plot examples:

@example
plot (x, y, "@@12", x, y2, x, y3, "4", x, y4, "+")
@end example

This command will plot @code{y} with points of type 2 (displayed as
@samp{+}) and color 1 (red), @code{y2} with lines, @code{y3} with lines of
color 4 (magenta) and @code{y4} with points displayed as @samp{+}.

@example
plot (b, "*")
@end example

This command will plot the data in the variable @code{b} will be plotted
with points displayed as @samp{*}.

@example
t = 0:0.1:6.3;
plot (t, cos(t), "-;cos(t);", t, sin(t), "+3;sin(t);");
@end example

This will plot the cosine and sine functions and label them accordingly
in the key.
@end deftypefn

@seealso{semilogx, semilogy, loglog, polar, mesh, contour, __pltopt__
bar, stairs, errorbar, replot, xlabel, ylabel, and title}


@anchor{doc-hold}
@deftypefn {Built-in Function} {} hold @var{args}
Tell Octave to `hold' the current data on the plot when executing
subsequent plotting commands.  This allows you to execute a series of
plot commands and have all the lines end up on the same figure.  The
default is for each new plot command to clear the plot device first.
For example, the command

@example
hold on
@end example

@noindent
turns the hold state on.  An argument of @code{off} turns the hold state
off, and @code{hold} with no arguments toggles the current hold state.
@end deftypefn


@anchor{doc-ishold}
@deftypefn {Built-in Function} {} ishold
Return 1 if the next line will be added to the current plot, or 0 if
the plot device will be cleared before drawing the next line.
@end deftypefn


@anchor{doc-clearplot}
@deftypefn {Built-in Function} {} clearplot
@deftypefnx {Built-in Function} {} clg
Clear the plot window and any titles or axis labels.  The name
@code{clg} is aliased to @code{clearplot} for compatibility with
@sc{Matlab}.

The commands @kbd{gplot clear}, @kbd{gsplot clear}, and @kbd{replot
clear} are equivalent to @code{clearplot}.  (Previously, commands like
@kbd{gplot clear} would evaluate @code{clear} as an ordinary expression
and clear all the visible variables.)
@end deftypefn


@anchor{doc-shg}
@deftypefn {Function File} {} shg

Show the graph window.  Currently, this is the same as executing
replot.

@end deftypefn

@seealso{plot, semilogx, semilogy, loglog, polar, mesh, contour,
bar, stairs, replot, xlabel, and ylabel}


@anchor{doc-closeplot}
@deftypefn {Built-in Function} {} closeplot
Close stream to the @code{gnuplot} subprocess.  If you are using X11,
this will close the plot window.
@end deftypefn


@anchor{doc-purge_tmp_files}
@deftypefn {Built-in Function} {} purge_tmp_files
Delete the temporary files created by the plotting commands.

Octave creates temporary data files for @code{gnuplot} and then sends
commands to @code{gnuplot} through a pipe.  Octave will delete the
temporary files on exit, but if you are doing a lot of plotting you may
want to clean up in the middle of a session.

A future version of Octave will eliminate the need to use temporary
files to hold the plot data.
@end deftypefn


@anchor{doc-axis}
@deftypefn {Function File} {} axis (@var{limits})
Set axis limits for plots.

The argument @var{limits} should be a 2, 4, or 6 element vector.  The
first and second elements specify the lower and upper limits for the x
axis.  The third and fourth specify the limits for the y axis, and the
fifth and sixth specify the limits for the z axis.

Without any arguments, @code{axis} turns autoscaling on.  

With one output argument, @code{x=axis} returns the current axes 
(this is not yet implemented for automatic axes).

The vector argument specifying limits is optional, and additional
string arguments may be used to specify various axis properties.  For
example,

@example
axis ([1, 2, 3, 4], "square");
@end example

@noindent
forces a square aspect ratio, and

@example
axis ("labely", "tic");
@end example

@noindent
turns tic marks on for all axes and tic mark labels on for the y-axis
only.

@noindent
The following options control the aspect ratio of the axes.

@table @code
@item "square"
Force a square aspect ratio.
@item "equal"
Force x distance to equal y-distance.
@item "normal"
Restore the balance.
@end table

@noindent
The following options control the way axis limits are interpreted.

@table @code
@item "auto" 
Set the specified axes to have nice limits around the data
or all if no axes are specified.
@item "manual" 
Fix the current axes limits.
@item "tight"
Fix axes to the limits of the data (not implemented).
@end table

@noindent
The option @code{"image"} is equivalent to @code{"tight"} and
@code{"equal"}.

@noindent
The following options affect the appearance of tic marks.

@table @code
@item "on" 
Turn tic marks and labels on for all axes.
@item "off"
Turn tic marks off for all axes.
@item "tic[xyz]"
Turn tic marks on for all axes, or turn them on for the
specified axes and off for the remainder.
@item "label[xyz]"
Turn tic labels on for all axes, or turn them on for the 
specified axes and off for the remainder.
@item "nolabel"
Turn tic labels off for all axes.
@end table
Note, if there are no tic marks for an axis, there can be no labels.

@noindent
The following options affect the direction of increasing values on
the axes.

@table @code
@item "ij"
Reverse y-axis, so lower values are nearer the top.
@item "xy" 
Restore y-axis, so higher values are nearer the top. 
@end table

@end deftypefn


@node Specialized Two-Dimensional Plots
@section Specialized Two-Dimensional Plots

@anchor{doc-bar}
@deftypefn {Function File} {} bar (@var{x}, @var{y})
Given two vectors of x-y data, @code{bar} produces a bar graph.

If only one argument is given, it is taken as a vector of y-values
and the x coordinates are taken to be the indices of the elements.

If two output arguments are specified, the data are generated but
not plotted.  For example,

@example
bar (x, y);
@end example

@noindent
and

@example
[xb, yb] = bar (x, y);
plot (xb, yb);
@end example

@noindent
are equivalent.
@end deftypefn

@seealso{plot, semilogx, semilogy, loglog, polar, mesh, contour,
stairs, replot, xlabel, ylabel, and title}


@anchor{doc-contour}
@deftypefn {Function File} {} contour (@var{z}, @var{n})
@deftypefnx {Function File} {} contour (@var{x}, @var{y}, @var{z}, @var{n})
Make a contour plot of the three-dimensional surface described by
@var{z}.  Someone needs to improve @code{gnuplot}'s contour routines
before this will be very useful.
@end deftypefn

@seealso{plot, semilogx, semilogy, loglog, polar, mesh, contour,
bar, stairs, replot, xlabel, ylabel, and title}


@anchor{doc-hist}
@deftypefn {Function File} {} hist (@var{y}, @var{x}, @var{norm})
Produce histogram counts or plots.

With one vector input argument, plot a histogram of the values with
10 bins.  The range of the histogram bins is determined by the range
of the data.

Given a second scalar argument, use that as the number of bins.

Given a second vector argument, use that as the centers of the bins,
with the width of the bins determined from the adjacent values in
the vector.

If third argument is provided, the histogram is normalised such that
the sum of the bars is equal to @var{norm}.

Extreme values are lumped in the first and last bins.

With two output arguments, produce the values @var{nn} and @var{xx} such
that @code{bar (@var{xx}, @var{nn})} will plot the histogram.
@end deftypefn

@seealso{bar}


@anchor{doc-loglog}
@deftypefn {Function File} {} loglog (@var{args})
Make a two-dimensional plot using log scales for both axes.  See the
description of @code{plot} for a description of the arguments that
@code{loglog} will accept.
@end deftypefn

@seealso{plot, semilogy, loglog, polar, mesh, contour, bar, stairs,
replot, xlabel, ylabel, and title}


@anchor{doc-polar}
@deftypefn {Function File} {} polar (@var{theta}, @var{rho}, @var{fmt})
Make a two-dimensional plot given polar the coordinates @var{theta} and
@var{rho}.

The optional third argument specifies the line type.
@end deftypefn

@seealso{plot, semilogx, semilogy, loglog, mesh, contour, bar,
stairs, replot, xlabel, ylabel, and title}


@anchor{doc-semilogx}
@deftypefn {Function File} {} semilogx (@var{args})
Make a two-dimensional plot using a log scale for the @var{x} axis.  See
the description of @code{plot} for a description of the arguments
that @code{semilogx} will accept.
@end deftypefn

@seealso{plot, semilogy, loglog, polar, mesh, contour, bar, stairs,
replot, xlabel, ylabel, and title}


@anchor{doc-semilogy}
@deftypefn {Function File} {} semilogy (@var{args})
Make a two-dimensional plot using a log scale for the @var{y} axis.  See
the description of @code{plot} for a description of the arguments
that @code{semilogy} will accept.
@end deftypefn

@seealso{plot, semilogx, loglog, polar, mesh, contour, bar, stairs,
replot, xlabel, ylabel, and title}


@anchor{doc-stairs}
@deftypefn {Function File} {} stairs (@var{x}, @var{y})
Given two vectors of x-y data, bar produces a `stairstep' plot.

If only one argument is given, it is taken as a vector of y-values
and the x coordinates are taken to be the indices of the elements.

If two output arguments are specified, the data are generated but
not plotted.  For example,

@example
stairs (x, y);
@end example

@noindent
and

@example
[xs, ys] = stairs (x, y);
plot (xs, ys);
@end example

@noindent
are equivalent.
@end deftypefn

@seealso{plot, semilogx, semilogy, loglog, polar, mesh, contour,
bar, replot, xlabel, ylabel, and title}


@anchor{doc-errorbar}
@deftypefn {Function File} {} errorbar (@var{args})
This function produces two-dimensional plots with errorbars. Many
different combinations of arguments are possible.  The simplest form is

@example
errorbar (@var{y}, @var{ey})
@end example

@noindent
where the first argument is taken as the set of @var{y} coordinates
and the second argument @var{ey} is taken as the errors of the
@var{y} values. @var{x} coordinates are taken to be the indices
of the elements, starting with 1.

If more than two arguments are given, they are interpreted as

@example
errorbar (@var{x}, @var{y}, ..., @var{fmt} ...)
@end example

@noindent
where after @var{x} and @var{y} there can be up to four error
parameters such as @var{ey}, @var{ex}, @var{ly}, @var{uy} etc.,
depending on the plot type. Any number of argument sets may appear,
as long as they are separated with a format string @var{fmt}.

If @var{y} is a matrix, @var{x} and error parameters must also be matrices
having same dimensions. The columns of @var{y} are plotted versus the
corresponding columns of @var{x} and errorbars are drawn from
the corresponding columns of error parameters.

If @var{fmt} is missing, yerrorbars ("~") plot style
is assumed.
If the @var{fmt} argument is supplied, it is interpreted as in
normal plots (See __pltopt__). In addition the following
plot styles are supported by errorbar:

@table @samp
@item ~
Set yerrorbars plot style (default).

@item >
Set xerrorbars plot style.

@item ~>
Set xyerrorbars plot style.

@item #
Set boxes plot style.

@item #~
Set boxerrorbars plot style.

@item #~>
Set boxxyerrorbars plot style.

@end table

Examples:

@example
errorbar(@var{x}, @var{y}, @var{ex}, ">")
@end example

xerrorbar plot of @var{y} versus @var{x} with @var{x} errorbars drawn from
@var{x}-@var{ex} to @var{x}+@var{ex}.

@example
errorbar(@var{x}, @var{y1}, @var{ey}, "~", @var{x}, @var{y2}, @var{ly}, @var{uy})
@end example

Two yerrorbar plots with @var{y1} and @var{y2} versus @var{x}.
Errorbars for @var{y1} are drawn from @var{y1}-@var{ey} to
@var{y1}+@var{ey}, errorbars for @var{y2} from @var{y2}-@var{ly} to
@var{y2}+@var{uy}.

@example
errorbar(@var{x}, @var{y}, @var{lx}, @var{ux}, @var{ly}, @var{uy}, "~>")
@end example

xyerrorbar plot of @var{y} versus @var{x} where @var{x} errorbars
are drawn from @var{x}-@var{lx} to @var{x}+@var{ux} and @var{y} errorbars
from @var{y}-@var{ly} to @var{y}+@var{uy}.

@end deftypefn

@seealso{semilogx, semilogy, loglog, polar, mesh, contour, __pltopt__,
bar, stairs, replot, xlabel, ylabel, and title}


@anchor{doc-loglogerr}
@deftypefn {Function File} {} loglogerr (@var{args})
This function produces two-dimensional plots on double logarithm axis 
with errorbars. Many different combinations of arguments are possible.  
The most used form is

@example
loglogerr (@var{x}, @var{y}, @var{ey}, @var{fmt})
@end example

@noindent
which produces a double logarithm plot of @var{y} versus @var{x} 
with errors in the @var{y}-scale defined by @var{ey} and the plot
format defined by @var{fmt}. See errorbar for available formats and 
additional information.

@end deftypefn

@seealso{errorbar, semilogxerr, semilogyerr, polar, mesh, contour, 
__pltopt__, bar, stairs, replot, xlabel, ylabel, and title}


@anchor{doc-semilogxerr}
@deftypefn {Function File} {} semilogxerr (@var{args})
This function produces two-dimensional plots on a semilogarithm axis 
with errorbars. Many different combinations of arguments are possible.  
The most used form is

@example
semilogxerr (@var{x}, @var{y}, @var{ey}, @var{fmt})
@end example

@noindent
which produces a semi-logarithm plot of @var{y} versus @var{x}
with errors in the @var{y}-scale defined by @var{ey} and the plot
format defined by @var{fmt}. See errorbar for available formats and 
additional information.

@end deftypefn

@seealso{errorbar, loglogerr semilogyerr, polar, mesh, contour, __pltopt__, 
bar, stairs, replot, xlabel, ylabel, and title}


@anchor{doc-semilogyerr}
@deftypefn {Function File} {} semilogyerr (@var{args})
This function produces two-dimensional plots on a semilogarithm axis 
with errorbars. Many different combinations of arguments are possible.  
The most used form is

@example
semilogyerr (@var{x}, @var{y}, @var{ey}, @var{fmt})
@end example

@noindent
which produces a semi-logarithm plot of @var{y} versus @var{x}
with errors in the @var{y}-scale defined by @var{ey} and the plot
format defined by @var{fmt}. See errorbar for available formats and 
additional information.

@end deftypefn

@seealso{errorbar, loglogerr semilogxerr, polar, mesh, contour, __pltopt__, 
bar, stairs, replot, xlabel, ylabel, and title}


@node Three-Dimensional Plotting
@section Three-Dimensional Plotting

The @sc{Matlab}-style three-dimensional plotting commands are:

@anchor{doc-mesh}
@deftypefn {Function File} {} mesh (@var{x}, @var{y}, @var{z})
Plot a mesh given matrices @var{x}, and @var{y} from @code{meshdom} and
a matrix @var{z} corresponding to the @var{x} and @var{y} coordinates of
the mesh.  If @var{x} and @var{y} are vectors, then a typical vertex
is (@var{x}(j), @var{y}(i), @var{z}(i,j)).  Thus, columns of @var{z}
correspond to different @var{x} values and rows of @var{z} correspond
to different @var{y} values.
@end deftypefn

@seealso{plot, semilogx, semilogy, loglog, polar, meshgrid, meshdom,
contour, bar, stairs, replot, xlabel, ylabel, and title}


@anchor{doc-meshgrid}
@deftypefn {Function File} {[@var{xx}, @var{yy}] =} meshgrid (@var{x}, @var{y})
@deftypefnx {Function File} {[@var{xx}, @var{yy}] =} meshgrid (@var{x})
Given vectors of @var{x} and @var{y} coordinates, return two matrices corresponding
to the @var{x} and @var{y} coordinates of a mesh.  The rows of @var{xx} are copies of @var{x},
and the columns of @var{yy} are copies of @var{y}.
@end deftypefn

@seealso{sombrero, plot, semilogx, semilogy, loglog, polar, mesh,
meshdom, contour, bar, stairs, replot, xlabel, ylabel, and title}


@anchor{doc-meshdom}
@deftypefn {Function File} {} meshdom (@var{x}, @var{y})
Given vectors of @var{x} and @var{y} coordinates, return two matrices
corresponding to the @var{x} and @var{y} coordinates of the mesh.

Note: this function is provided for compatibility with older versions
of @sc{Matlab}.  You should use @code{meshgrid} instead.
@end deftypefn


@node Plot Annotations
@section Plot Annotations

@anchor{doc-grid}
@deftypefn {Function File} {} grid (@var{arg})
For two-dimensional plotting, force the display of a grid on the plot.
The argument may be either @code{"on"} or @code{"off"}.  If it is
omitted, @code{"on"} is assumed.
@end deftypefn

@seealso{plot, semilogx, semilogy, loglog, polar, mesh, contour,
bar, stairs, replot, xlabel, ylabel, and title}


@anchor{doc-title}
@deftypefn {Function File} {} title (@var{string})
Specify a title for a plot.
@end deftypefn

@seealso{plot, semilogx, semilogy, loglog, polar, mesh, contour,
bar, stairs, replot, xlabel, and ylabel}


@anchor{doc-xlabel}
@deftypefn {Function File} {} xlabel (@var{string})
@deftypefnx {Function File} {} ylabel (@var{string})
@deftypefnx {Function File} {} zlabel (@var{string})
Specify x, y, and z axis labels for the plot.  If you already have a plot
displayed, use the command @code{replot} to redisplay it with the new
labels.
@end deftypefn

@seealso{plot, semilogx, semilogy, loglog, polar, mesh, contour,
bar, stairs, replot, ylabel, and title}


@anchor{doc-top_title}
@deftypefn {Function File} {} top_title (@var{string})
@deftypefnx {Function File} {} bottom_title (@var{string})
Makes a title with text @var{string} at the top (bottom) of the plot.
@end deftypefn


@node Multiple Plots on One Page
@section Multiple Plots on One Page

The following functions all require a version of @code{gnuplot} that
supports the multiplot feature.

@anchor{doc-mplot}
@deftypefn {Function File} {} mplot (@var{x}, @var{y})
@deftypefnx {Function File} {} mplot (@var{x}, @var{y}, @var{fmt})
@deftypefnx {Function File} {} mplot (@var{x1}, @var{y1}, @var{x2}, @var{y2})
This is a modified version of the @code{plot} function that works with
the multiplot version of @code{gnuplot} to plot multiple plots per page.
This plot version automatically advances to the next subplot position
after each set of arguments are processed.

See the description of the @var{plot} function for the various options.
@end deftypefn


@anchor{doc-multiplot}
@deftypefn {Function File} {} multiplot (@var{xn}, @var{yn})
Sets and resets multiplot mode.

If the arguments are non-zero, @code{multiplot} will set up multiplot
mode with @var{xn}, @var{yn} subplots along the @var{x} and @var{y}
axes.  If both arguments are zero, @code{multiplot} closes multiplot
mode.
@end deftypefn


@anchor{doc-oneplot}
@deftypefn {Function File} {} oneplot ()
If in multiplot mode, switches to single plot mode.
@end deftypefn


@anchor{doc-plot_border}
@deftypefn {Function File} {} plot_border (...)
Multiple arguments allowed to specify the sides on which the border
is shown.  Allowed arguments include:

@table @code
@item "blank"
No borders displayed.

@item "all"
All borders displayed

@item "north"
North Border

@item "south"
South Border

@item "east"
East Border

@item "west"
West Border
@end table

@noindent
The arguments may be abbreviated to single characters.  Without any
arguments, @code{plot_border} turns borders off.
@end deftypefn


@anchor{doc-subplot}
@deftypefn {Function File} {} subplot (@var{rows}, @var{cols}, @var{index})
@deftypefnx {Function File} {} subplot (@var{rcn})
Sets @code{gnuplot} in multiplot mode and plots in location
given by index (there are @var{cols} by @var{rows} subwindows).

The global variable @var{__multiplot_scale__} should be used when the
command @code{__gnuplot_set__ size xsize, ysize} has been used prior to calling
@code{subplot}.

The value of @var{__multiplot_scale__} should be a vector with two
elements, the first set equal to @var{xsize} and the second to
@var{ysize}.

Input:

@table @var
@item rows
Number of rows in subplot grid.

@item columns
Number of columns in subplot grid.

@item index
Index of subplot where to make the next plot.
@end table

If only one argument is supplied, then it must be a three digit value
specifying the location in digits 1 (rows) and 2 (columns) and the plot
index in digit 3.

The plot index runs row-wise.  First all the columns in a row are filled
and then the next row is filled.

For example, a plot with 4 by 2 grid will have plot indices running as
follows:
@iftex
@tex
\vskip 10pt
\hfil\vbox{\offinterlineskip\hrule
\halign{\vrule#&&\qquad\hfil#\hfil\qquad\vrule\cr
height13pt&1&2&3&4\cr height12pt&&&&\cr\noalign{\hrule}
height13pt&5&6&7&8\cr height12pt&&&&\cr\noalign{\hrule}}}
\hfil
\vskip 10pt
@end tex
@end iftex
@ifinfo
@display
@group
+-----+-----+-----+-----+
|  1  |  2  |  3  |  4  |
+-----+-----+-----+-----+
|  5  |  6  |  7  |  8  |
+-----+-----+-----+-----+
@end group
@end display
@end ifinfo
@end deftypefn


@anchor{doc-subwindow}
@deftypefn {Function File} {} subwindow (@var{xn}, @var{yn})
Sets the subwindow position in multiplot mode for the next plot.  The
multiplot mode has to be previously initialized using the
@code{multiplot} function, otherwise this command just becomes an alias
to @code{multiplot}
@end deftypefn


@node Multiple Plot Windows
@section Multiple Plot Windows

@anchor{doc-figure}
@deftypefn {Function File} {} figure (@var{n})
Set the current plot window to plot window @var{n}.  This function
currently requires X11 and a version of gnuplot that supports multiple
frames.  If @var{n} is not specified, the next available window
number is chosen.
@end deftypefn


@c @node Exporting Plots
@c XXX FIXME XXX -- add info about getting paper copies of plots.

@node Low-Level plotting commands
@section Low-Level plotting commands

@deffn {Command} gplot @var{ranges} @var{expression} @var{using} @var{title} @var{style}
Generate a 2-dimensional plot.

The @var{ranges}, @var{using}, @var{title}, and @var{style} arguments
are optional, and the @var{using}, @var{title} and @var{style}
qualifiers may appear in any order after the expression.  You may plot
multiple expressions with a single command by separating them with
commas.  Each expression may have its own set of qualifiers.

The optional item @var{ranges} has the syntax

@example
[ x_lo : x_up ] [ y_lo : y_up ]
@end example

@noindent
and may be used to specify the ranges for the axes of the plot,
independent of the actual range of the data.  The range for the y axis
and any of the individual limits may be omitted.  A range @code{[:]}
indicates that the default limits should be used.  This normally means
that a range just large enough to include all the data points will be
used.

The expression to be plotted must not contain any literal matrices
(e.g. @code{[ 1, 2; 3, 4 ]}) since it is nearly impossible to
distinguish a plot range from a matrix of data.

See the help for @code{gnuplot} for a description of the syntax for the
optional items.

By default, the @code{gplot} command plots the second column of a matrix
versus the first.  If the matrix only has one column, it is taken as a
vector of y-coordinates and the x-coordinate is taken as the element
index, starting with zero.  For example,

@example
gplot rand (100,1) with linespoints
@end example

@noindent
will plot 100 random values and connect them with lines.  When
@code{gplot} is used to plot a column vector, the indices of the
elements are taken as x values.

  If there are more than two columns, you can
choose which columns to plot with the @var{using} qualifier. For
example, given the data

@example
x = (-10:0.1:10)';
data = [x, sin(x), cos(x)];
@end example

@noindent
the command

@example
gplot [-11:11] [-1.1:1.1] \
  data with lines, data using 1:3 with impulses
@end example

@noindent
will plot two lines.  The first line is generated by the command
@code{data with lines}, and is a graph of the sine function over the
range @minus{}10 to 10.  The data is taken from the first two columns of
the matrix because columns to plot were not specified with the
@var{using} qualifier.

The clause @code{using 1:3} in the second part of this plot command
specifies that the first and third columns of the matrix @code{data}
should be taken as the values to plot.

In this example, the ranges have been explicitly specified to be a bit
larger than the actual range of the data so that the curves do not touch
the border of the plot.
@end deffn

@deffn {Command} gsplot @var{ranges} @var{expression} @var{using} @var{title} @var{style}
Generate a 3-dimensional plot.

The @var{ranges}, @var{using}, @var{title}, and @var{style} arguments
are optional, and the @var{using}, @var{title} and @var{style}
qualifiers may appear in any order after the expression.  You may plot
multiple expressions with a single command by separating them with
commas.  Each expression may have its own set of qualifiers.

The optional item @var{ranges} has the syntax

@example
[ x_lo : x_up ] [ y_lo : y_up ] [ z_lo : z_up ]
@end example

@noindent
and may be used to specify the ranges for the axes of the plot,
independent of the actual range of the data.  The range for the y and z
axes and any of the individual limits may be omitted.  A range
@code{[:]} indicates that the default limits should be used.  This
normally means that a range just large enough to include all the data
points will be used.

The expression to be plotted must not contain any literal matrices (e.g.
@code{[ 1, 2; 3, 4 ]}) since it is nearly impossible to distinguish a
plot range from a matrix of data.

See the help for @code{gnuplot} for a description of the syntax for the
optional items.

By default, the @code{gsplot} command plots each column of the
expression as the z value, using the row index as the x value, and the
column index as the y value.  The indices are counted from zero, not
one.  For example,

@example
gsplot rand (5, 2)
@end example

@noindent
will plot a random surface, with the x and y values taken from the row
and column indices of the matrix.

If parametric plotting mode is set (using the command
@kbd{gset parametric}, then @code{gsplot} takes the columns of the
matrix three at a time as the x, y and z values that define a line in
three space.  Any extra columns are ignored, and the x and y values are
expected to be sorted.  For example, with @code{parametric} set, it
makes sense to plot a matrix like
@iftex
@tex
$$
\left[\matrix{
1 & 1 & 3 & 2 & 1 & 6 & 3 & 1 & 9 \cr
1 & 2 & 2 & 2 & 2 & 5 & 3 & 2 & 8 \cr
1 & 3 & 1 & 2 & 3 & 4 & 3 & 3 & 7}\right]
$$
@end tex
@end iftex
@ifinfo

@example
1 1 3 2 1 6 3 1 9
1 2 2 2 2 5 3 2 8
1 3 1 2 3 4 3 3 7
@end example
@end ifinfo

@noindent
but not @code{rand (5, 30)}.
@end deffn

@deffn {Command} gset options
@deffnx {Command} gshow options
@deffnx {Command} replot options
In addition to the basic plotting commands, the whole range of
@code{gset} and @code{gshow} commands from @code{gnuplot} are available,
as is @code{replot}.

@findex set
@findex show
Note that in Octave 2.0, the @code{set} and @code{show} commands were
renamed to @code{gset} and @code{gshow} in order to allow for
compatibility with the @sc{Matlab} graphics and GUI commands in a future
version of Octave.  (For now, the old @code{set} and @code{show}
commands do work, but they print an annoying warning message to try to
get people to switch to using @code{gset} and @code{gshow}.)

The @code{gset} and @code{gshow} commands allow you to set and show
@code{gnuplot} parameters.  For more information about the @code{gset}
and @code{gshow} commands, see the documentation for @code{set} and
@code{show} in the @code{gnuplot} user's guide (also available on line
if you run @code{gnuplot} directly, instead of running it from Octave).

The @code{replot} command allows you to force the plot to be
redisplayed.  This is useful if you have changed something about the
plot, such as the title or axis labels.  The @code{replot} command also
accepts the same arguments as @code{gplot} or @code{gsplot} (except for
data ranges) so you can add additional lines to existing plots.  

For example,

@example
gset term tek40
gset output "/dev/plotter"
gset title "sine with lines and cosine with impulses"
replot "sin (x) w l"
@end example

will change the terminal type for plotting, add a title to the current
plot, add a graph of
@iftex
@tex
$\sin(x)$
@end tex
@end iftex
@ifinfo
sin (x) 
@end ifinfo
to the plot, and force the new plot to be
sent to the plot device.  This last step is normally required in order
to update the plot.  This default is reasonable for slow terminals or
hardcopy output devices because even when you are adding additional
lines with a replot command, gnuplot always redraws the entire plot, and
you probably don't want to have a completely new plot generated every
time something as minor as an axis label changes.

@findex shg
The command @code{shg} is equivalent to executing @code{replot} without
any arguments.
@end deffn

Note that NaN values in the plot data are automatically omitted, and
Inf values are converted to a very large value before calling gnuplot.

@c XXX FIXME XXX -- add info about what to do to get plots on remote X
@c terminals.  People often forget how to properly set DISPLAY and run
@c xhost.


@node Interaction with gnuplot
@section Interaction with @code{gnuplot}

@anchor{doc-gnuplot_binary}
@defvr {Built-in Variable} gnuplot_binary
The name of the program invoked by the plot command.  The default value
is @code{"gnuplot"}.  @xref{Installation}.
@end defvr


@anchor{doc-gnuplot_has_frames}
@defvr {Built-in Variable} gnuplot_has_frames
If the value of this variable is nonzero, Octave assumes that your copy
of gnuplot has support for multiple frames that is included in recent
3.6beta releases.  Its initial value is determined by configure, but it
can be changed in your startup script or at the command line in case
configure got it wrong, or if you upgrade your gnuplot installation.
@end defvr


@anchor{doc-gnuplot_command_plot}
@defvr {Built-in Variable} gnuplot_command_plot
@end defvr


@anchor{doc-gnuplot_command_replot}
@defvr {Built-in Variable} gnuplot_command_replot
@end defvr


@anchor{doc-gnuplot_command_splot}
@defvr {Built-in Variable} gnuplot_command_splot
@end defvr


@anchor{doc-gnuplot_command_using}
@defvr {Built-in Variable} gnuplot_command_using
@end defvr


@anchor{doc-gnuplot_command_with}
@defvr {Built-in Variable} gnuplot_command_with
@end defvr


@anchor{doc-gnuplot_command_axes}
@defvr {Built-in Variable} gnuplot_command_axes
@end defvr


@anchor{doc-gnuplot_command_title}
@defvr {Built-in Variable} gnuplot_command_title
@end defvr


@anchor{doc-gnuplot_command_end}
@defvr {Built-in Variable} gnuplot_command_end
@end defvr