-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgnuplot.doc
More file actions
7475 lines (6444 loc) · 298 KB
/
gnuplot.doc
File metadata and controls
7475 lines (6444 loc) · 298 KB
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
C RCS $Id: gnuplot.doc,v 1.40.2.14 2000/10/31 14:48:18 joze Exp $
C 3 December 1998
C Copyright (C) 1986 - 1993, 1998 Thomas Williams, Colin Kelley
C
^ <h2> An Interactive Plotting Program </h2><p>
^ <h2> Thomas Williams & Colin Kelley</h2><p>
^ <h2> Version 3.7 organized by: David Denholm </h2><p>
^ <h2>Major contributors (alphabetic order):</h2>
^<ul><h3>
^<li> Hans-Bernhard Broeker
^<li> John Campbell
^<li> Robert Cunningham
^<li> David Denholm
^<li> Gershon Elber
^<li> Roger Fearick
^<li> Carsten Grammes
^<li> Lucas Hart
^<li> Lars Hecking
^<li> Thomas Koenig
^<li> David Kotz
^<li> Ed Kubaitis
^<li> Russell Lang
^<li> Alexander Lehmann
^<li> Alexander Mai
^<li> Carsten Steger
^<li> Tom Tkacik
^<li> Jos Van der Woude
^<li> James R. Van Zandt
^<li> Alex Woo
^</h3></ul> <p>
^<h2> Copyright (C) 1986 - 1993, 1998 Thomas Williams, Colin Kelley<p>
^ Mailing list for comments: [email protected] <p>
^ Mailing list for bug reports: [email protected]<p>
^</h2><p>
^<h3> This manual was prepared by Dick Crawford</h3><p>
^<h3> 3 December 1998</h3><p>
^<hr>
1 gnuplot
2 Copyright
?copyright
?license
Copyright (C) 1986 - 1993, 1998 Thomas Williams, Colin Kelley
Permission to use, copy, and distribute this software and its
documentation for any purpose with or without fee is hereby granted,
provided that the above copyright notice appear in all copies and
that both that copyright notice and this permission notice appear
in supporting documentation.
Permission to modify the software is granted, but not the right to
distribute the complete modified source code. Modifications are to
be distributed as patches to the released version. Permission to
distribute binaries produced by compiling modified sources is granted,
provided you
1. distribute the corresponding source modifications from the
released version in the form of a patch file along with the binaries,
2. add special version identification to distinguish your version
in addition to the base release version number,
3. provide your name and address as the primary contact for the
support of your modified version, and
4. retain our contact information in regard to use of the base
software.
Permission to distribute the released version of the source code along
with corresponding source modifications in the form of a patch file is
granted with same provisions 2 through 4 for binary distributions.
This software is provided "as is" without express or implied warranty
to the extent permitted by applicable law.
AUTHORS
Original Software:
Thomas Williams, Colin Kelley.
Gnuplot 2.0 additions:
Russell Lang, Dave Kotz, John Campbell.
Gnuplot 3.0 additions:
Gershon Elber and many others.
2 Introduction
?introduction
?
`gnuplot` is a command-driven interactive function and data plotting program.
It is case sensitive (commands and function names written in lowercase are
not the same as those written in CAPS). All command names may be abbreviated
as long as the abbreviation is not ambiguous. Any number of commands may
appear on a line (with the exception that `load` or `call` must be the final
command), separated by semicolons (;). Strings are indicated with quotes.
They may be either single or double quotation marks, e.g.,
load "filename"
cd 'dir'
although there are some subtle differences (see `syntax` for more details).
Any command-line arguments are assumed to be names of files containing
`gnuplot` commands, with the exception of standard X11 arguments, which are
processed first. Each file is loaded with the `load` command, in the order
specified. `gnuplot` exits after the last file is processed. When no load
files are named, `gnuplot` enters into an interactive mode. The special
filename "-" is used to denote standard input. See "help batch/interactive"
for more details.
Many `gnuplot` commands have multiple options. These options must appear in
the proper order, although unwanted ones may be omitted in most cases. Thus
if the entire command is "command a b c", then "command a c" will probably
work, but "command c a" will fail.
Commands may extend over several input lines by ending each line but the last
with a backslash (\). The backslash must be the _last_ character on each
line. The effect is as if the backslash and newline were not there. That
is, no white space is implied, nor is a comment terminated. Therefore,
commenting out a continued line comments out the entire command (see
`comment`). But note that if an error occurs somewhere on a multi-line
command, the parser may not be able to locate precisely where the error is
and in that case will not necessarily point to the correct line.
In this document, curly braces ({}) denote optional arguments and a vertical
bar (|) separates mutually exclusive choices. `gnuplot` keywords or `help`
topics are indicated by backquotes or `boldface` (where available). Angle
brackets (<>) are used to mark replaceable tokens. In many cases, a default
value of the token will be taken for optional arguments if the token is
omitted, but these cases are not always denoted with braces around the angle
brackets.
For on-line help on any topic, type `help` followed by the name of the topic
or just `help` or `?` to get a menu of available topics.
The new `gnuplot` user should begin by reading about `plotting` (if on-line,
type `help plotting`).
^ <a href="http://www.nas.nasa.gov/~woo/gnuplot/simple/simple.html"> Simple Plots Demo </a>
2 Seeking-assistance
?seeking-assistance
There is a mailing list for `gnuplot` users. Note, however, that the
newsgroup
comp.graphics.apps.gnuplot
is identical to the mailing list (they both carry the same set of messages).
We prefer that you read the messages through the newsgroup rather than
subscribing to the mailing list. Administrative requests should be sent to
Send a message with the body (not the subject) consisting of the single word
"help" (without the quotes) for more details.
The address for mailing to list members is:
Bug reports and code contributions should be mailed to:
The list of those interested in beta-test versions is:
There is also a World Wide Web page with up-to-date information, including
known bugs:
^ <a href="http://www.cs.dartmouth.edu/gnuplot_info.html">
http://www.cs.dartmouth.edu/gnuplot_info.html
^ </a>
Before seeking help, please check the
^ <a href="http://www.uni-karlsruhe.de/~ig25/gnuplot-faq.html">
FAQ (Frequently Asked Questions) list.
^ </a>
If you do not have a copy of the FAQ, you may request a copy by email from
the Majordomo address above, ftp a copy from
ftp://ftp.dartmouth.edu/pub/gnuplot
or see the WWW `gnuplot` page.
When posting a question, please include full details of the version of
`gnuplot`, the machine, and operating system you are using. A _small_ script
demonstrating the problem may be useful. Function plots are preferable to
datafile plots. If email-ing to info-gnuplot, please state whether or not
you are subscribed to the list, so that users who use news will know to email
a reply to you. There is a form for such postings on the WWW site.
2 What's New in version 3.7
?new-features
Gnuplot version 3.7 contains many new features. This section gives a partial
list and links to the new items in no particular order.
1. `fit f(x) 'file' via` uses the Marquardt-Levenberg method to fit data.
(This is only slightly different from the `gnufit` patch available for 3.5.)
2. Greatly expanded `using` command. See `plot using`.
3. `set timefmt` allows for the use of dates as input and output for time
series plots. See `Time/Date data` and
^ <a href="http://www.nas.nasa.gov/~woo/gnuplot/timefmt/timefmt.html">
timedat.dem.
^ </a>
4. Multiline labels and font selection in some drivers.
5. Minor (unlabeled) tics. See `set mxtics`.
6. `key` options for moving the key box in the page (and even outside of the
plot), putting a title on it and a box around it, and more. See `set key`.
7. Multiplots on a single logical page with `set multiplot`.
8. Enhanced `postscript` driver with super/subscripts and font changes.
(This was a separate driver (`enhpost`) that was available as a patch for
3.5.)
9. Second axes: use the top and right axes independently of the bottom and
left, both for plotting and labels. See `plot`.
10. Special datafile names `'-'` and `""`. See `plot special-filenames`.
11. Additional coordinate systems for labels and arrows. See `coordinates`.
12. `set size` can try to plot with a specified aspect ratio.
13. `set missing` now treats missing data correctly.
14. The `call` command: `load` with arguments.
15. More flexible `range` commands with `reverse`, `writeback`, and `restore`
keywords.
16. `set encoding` for multi-lingual encoding.
17. New `x11` driver with persistent and multiple windows.
18. New plotting styles: `xerrorbars`, `errorlines`, `yerrorlines`,
`xerrorlines`, `xyerrorlines`, `histeps`, `financebars` and more.
See `set style`.
19. New tic label formats, including `"%l %L"` which uses the mantissa and
exponents to a given base for labels. See `set format`.
20. New drivers, including `cgm` for inclusion into MS-Office applications
and `gif` for serving plots to the WEB.
21. Smoothing and spline-fitting options for `plot`. See `plot smooth`.
22. `set margin` and `set origin` give much better control over where a
graph appears on the page.
23. `set border` now controls each border individually.
24. The new commands `if` and `reread` allow command loops.
25. Point styles and sizes, line types and widths can be specified on the
`plot` command. Line types and widths can also be specified for grids,
borders, tics and arrows. See `plot with`. Furthermore these types may be
combined and stored for further use. See `set style line`.
26. Text (labels, tic labels, and the time stamp) can be written vertically
by those terminals capable of doing so.
2 bind
?commands bind
?bind
The `bind` command allows to (re-)define a sequence of gnuplot commands
which will be executed when a certain key or key sequence is pressed
while the driver's window has the input focus.
Note that `bind` is only available if gnuplot was compiled with mouse
support and it is used by all mouse-capable terminals.
Bindings overwrite the builtin bindings (like in every real editor),
except <space> and 'q' which cannot be rebound.
Mouse Buttons cannot be rebound.
Note that multikey-bindings with modifiers have to be quoted.
Syntax:
bind [<key-sequence>] ["<gnuplot commands>"]
bind!
Examples:
- set bindings:
bind a "replot"
bind "ctrl-a" "plot x*x"
bind "ctrl-alt-a" 'print "great"'
bind Home "set view 60,30; replot"
- show bindings:
bind "ctrl-a" # shows the binding for ctrl-a
bind # shows all bindings
- remove bindings:
bind "ctrl-alt-a" "" # removes binding for ctrl-alt-a
(note that builtins cannot be removed)
bind! # installs default (builtin) bindings
- bind a key to toggle something:
v=0
bind "ctrl-r" "v=v+1;if(v%2)set term x11 noraise; else set term x11 raise"
Modifiers (ctrl / alt) are case insensitive, keys not:
ctrl-alt-a == CtRl-alT-a
ctrl-alt-a != ctrl-alt-A
List of modifiers (alt == meta):
ctrl, alt
List of supported special keys:
"BackSpace", "Tab", "Linefeed", "Clear", "Return", "Pause", "Scroll_Lock",
"Sys_Req", "Escape", "Delete", "Home", "Left", "Up", "Right", "Down",
"PageUp", "PageDown", "End", "Begin",
"KP_Space", "KP_Tab", "KP_Enter", "KP_F1", "KP_F2", "KP_F3", "KP_F4",
"KP_Home", "KP_Left", "KP_Up", "KP_Right", "KP_Down", "KP_PageUp",
"KP_PageDown", "KP_End", "KP_Begin", "KP_Insert", "KP_Delete", "KP_Equal",
"KP_Multiply", "KP_Add", "KP_Separator", "KP_Subtract", "KP_Decimal",
"KP_Divide",
"KP_1" - "KP_9", "F1" - "F12"
see also `help mouse` and `help if`.
2 Batch/Interactive Operation
?batch/interactive
`gnuplot` may be executed in either batch or interactive modes, and the two
may even be mixed together on many systems.
Any command-line arguments are assumed to be names of files containing
`gnuplot` commands (with the exception of standard X11 arguments, which are
processed first). Each file is loaded with the `load` command, in the order
specified. `gnuplot` exits after the last file is processed. When no load
files are named, `gnuplot` enters into an interactive mode. The special
filename "-" is used to denote standard input.
Both the `exit` and `quit` commands terminate the current command file and
`load` the next one, until all have been processed.
Examples:
To launch an interactive session:
gnuplot
To launch a batch session using two command files "input1" and "input2":
gnuplot input1 input2
To launch an interactive session after an initialization file "header" and
followed by another command file "trailer":
gnuplot header - trailer
2 Command-line-editing
?line-editing
?editing
?command-line-editing
Command-line editing is supported by the Unix, Atari, VMS, MS-DOS and OS/2
versions of `gnuplot`. Also, a history mechanism allows previous commands to
be edited and re-executed. After the command line has been edited, a newline
or carriage return will enter the entire line without regard to where the
cursor is positioned.
(The readline function in `gnuplot` is not the same as the readline used in
GNU Bash and GNU Emacs. If the GNU version is desired, it may be selected
instead of the `gnuplot` version at compile time.)
The editing commands are as follows:
@start table - first is interactive cleartext form
`Line-editing`:
^B moves back a single character.
^F moves forward a single character.
^A moves to the beginning of the line.
^E moves to the end of the line.
^H and DEL delete the previous character.
^D deletes the current character.
^K deletes from current position to the end of line.
^L,^R redraws line in case it gets trashed.
^U deletes the entire line.
^W deletes the last word.
`History`:
^P moves back through history.
^N moves forward through history.
#\begin{tabular}{|cl|} \hline
#\multicolumn{2}{|c|}{Command-line Editing Commands} \\ \hline \hline
#Character & Function \\ \hline
# & \multicolumn{1}{|c|}{Line Editing}\\ \cline{2-2}
#\verb~^B~ & move back a single character.\\
#\verb~^F~ & move forward a single character.\\
#\verb~^A~ & move to the beginning of the line.\\
#\verb~^E~ & move to the end of the line.\\
#\verb~^H, DEL~ & delete the previous character.\\
#\verb~^D~ & delete the current character.\\
#\verb~^K~ & delete from current position to the end of line.\\
#\verb~^L, ^R~ & redraw line in case it gets trashed.\\
#\verb~^U~ & delete the entire line. \\
#\verb~^W~ & delete from the current word to the end of line. \\ \hline
# & \multicolumn{1}{|c|}{History} \\ \cline{2-2}
#\verb~^P~ & move back through history.\\
#\verb~^N~ & move forward through history.\\
%c l .
%Character@Function
%_
%@Line Editing
%^B@move back a single character.
%^F@move forward a single character.
%^A@move to the beginning of the line.
%^E@move to the end of the line.
%^H, DEL@delete the previous character.
%^D@delete the current character.
%^K@delete from current position to the end of line.
%^L, ^R@redraw line in case it gets trashed.
%^U@delete the entire line.
%^W@delete from the current word to the end of line.
%_
%@History
%^P@move back through history.
%^N@move forward through history.
@end table
On the IBM PC, the use of a TSR program such as DOSEDIT or CED may be desired
for line editing. The default makefile assumes that this is the case; by
default `gnuplot` will be compiled with no line-editing capability. If you
want to use `gnuplot`'s line editing, set READLINE in the makefile and add
readline.obj to the link file. The following arrow keys may be used on the
IBM PC and Atari versions if readline is used:
@start table - first is interactive cleartext form
Left Arrow - same as ^B.
Right Arrow - same as ^F.
Ctrl Left Arrow - same as ^A.
Ctrl Right Arrow - same as ^E.
Up Arrow - same as ^P.
Down Arrow - same as ^N.
#\begin{tabular}{|cl|} \hline
#Arrow key & Function \\ \hline
#Left & same as \verb~^B~. \\
#Right & same as \verb~^F~. \\
#Ctrl Left & same as \verb~^A~. \\
#Ctrl Right & same as \verb~^E~. \\
#Up & same as \verb~^P~. \\
#Down & same as \verb~^N~. \\
%c l .
%Arrow key@Function
%_
%Left Arrow@same as ^B.
%Right Arrow@same as ^F.
%Ctrl Left Arrow@same as ^A.
%Ctrl Right Arrow@same as ^E.
%Up Arrow@same as ^P.
%Down Arrow@same as ^N.
%_
@end table
The Atari version of readline defines some additional key aliases:
@start table - first is interactive cleartext form
Undo - same as ^L.
Home - same as ^A.
Ctrl Home - same as ^E.
Esc - same as ^U.
Help - `help` plus return.
Ctrl Help - `help `.
#\begin{tabular}{|cl|} \hline
#Arrow key & Function \\ \hline
#Undo & same as \verb~^L~. \\
#Home & same as \verb~^A~. \\
#Ctrl Home & same as \verb~^E~. \\
#Esc & same as \verb~^U~. \\
#Help & `{\bf help}` plus return. \\
#Ctrl Help & `{\bf help}`. \\
%c l .
%Arrow key@Function
%_
%Undo@same as ^L.
%Home@same as ^A.
%Ctrl Home@same as ^E.
%Esc@same as ^U.
%Help@help plus return.
%Ctrl Help@help .
%_
@end table
2 Comments
?comments
Comments are supported as follows: a `#` may appear in most places in a line
and `gnuplot` will ignore the rest of the line. It will not have this effect
inside quotes, inside numbers (including complex numbers), inside command
substitutions, etc. In short, it works anywhere it makes sense to work.
2 Coordinates
?coordinates
The commands `set arrow`, `set key`, and `set label` allow you to draw
something at an arbitrary position on the graph. This position is specified
by the syntax:
{<system>} <x>, {<system>} <y> {,{<system>} <z>}
Each <system> can either be `first`, `second`, `graph` or `screen`.
`first` places the x, y, or z coordinate in the system defined by the left
and bottom axes; `second` places it in the system defined by the second axes
(top and right); `graph` specifies the area within the axes---0,0 is bottom
left and 1,1 is top right (for splot, 0,0,0 is bottom left of plotting area;
use negative z to get to the base---see `set ticslevel`); and `screen`
specifies the screen area (the entire area---not just the portion selected by
`set size`), with 0,0 at bottom left and 1,1 at top right.
If the coordinate system for x is not specified, `first` is used. If the
system for y is not specified, the one used for x is adopted.
If one (or more) axis is timeseries, the appropriate coordinate should
be given as a quoted time string according to the `timefmt` format string.
See `set xdata` and `set timefmt`. `gnuplot` will also accept an integer
expression, which will be interpreted as seconds from 1 January 2000.
2 Environment
?environment
A number of shell environment variables are understood by `gnuplot`. None of
these are required, but may be useful.
If GNUTERM is defined, it is used as the name of the terminal type to be
used. This overrides any terminal type sensed by `gnuplot` on start-up, but
is itself overridden by the .gnuplot (or equivalent) start-up file (see
`start-up`) and, of course, by later explicit changes.
On Unix, AmigaOS, AtariTOS, MS-DOS and OS/2, GNUHELP may be defined to be the
pathname of the HELP file (gnuplot.gih).
On VMS, the logical name GNUPLOT$HELP should be defined as the name of the
help library for `gnuplot`. The `gnuplot` help can be put inside any system
help library, allowing access to help from both within and outside `gnuplot`
if desired.
On Unix, HOME is used as the name of a directory to search for a .gnuplot
file if none is found in the current directory. On AmigaOS, AtariTOS,
MS-DOS and OS/2, gnuplot is used. On VMS, SYS$LOGIN: is used. See `help
start-up`.
On Unix, PAGER is used as an output filter for help messages.
On Unix, AtariTOS and AmigaOS, SHELL is used for the `shell` command. On
MS-DOS and OS/2, COMSPEC is used for the `shell` command.
On MS-DOS, if the BGI or Watcom interface is used, PCTRM is used to tell
the maximum resolution supported by your monitor by setting it to
S<max. horizontal resolution>. E.g. if your monitor's maximum resolution is
800x600, then use:
set PCTRM=S800
If PCTRM is not set, standard VGA is used.
FIT_SCRIPT may be used to specify a `gnuplot` command to be executed when a
fit is interrupted---see `fit`. FIT_LOG specifies the filename of the
logfile maintained by fit.
GNUPLOT_LIB may be used to define additional search directories for data
and command files. The variable may contain a single directory name, or
a list of directories separated by a platform-specific path separator,
eg. ':' on Unix, or ';' on DOS/Windows/OS/2/Amiga platforms. The contents
of GNUPLOT_LIB are appended to the `loadpath` variable, but not saved
with the `save` and `save set` commands.
2 Expressions
?expressions
In general, any mathematical expression accepted by C, FORTRAN, Pascal, or
BASIC is valid. The precedence of these operators is determined by the
specifications of the C programming language. White space (spaces and tabs)
is ignored inside expressions.
Complex constants are expressed as {<real>,<imag>}, where <real> and <imag>
must be numerical constants. For example, {3,2} represents 3 + 2i; {0,1}
represents 'i' itself. The curly braces are explicitly required here.
Note that gnuplot uses both "real" and "integer" arithmetic, like FORTRAN and
C. Integers are entered as "1", "-10", etc; reals as "1.0", "-10.0", "1e1",
3.5e-1, etc. The most important difference between the two forms is in
division: division of integers truncates: 5/2 = 2; division of reals does
not: 5.0/2.0 = 2.5. In mixed expressions, integers are "promoted" to reals
before evaluation: 5/2e0 = 2.5. The result of division of a negative integer
by a positive one may vary among compilers. Try a test like "print -5/2" to
determine if your system chooses -2 or -3 as the answer.
The integer expression "1/0" may be used to generate an "undefined" flag,
which causes a point to ignored; the `ternary` operator gives an example.
The real and imaginary parts of complex expressions are always real, whatever
the form in which they are entered: in {3,2} the "3" and "2" are reals, not
integers.
3 Functions
?expressions functions
?functions
The functions in `gnuplot` are the same as the corresponding functions in
the Unix math library, except that all functions accept integer, real, and
complex arguments, unless otherwise noted.
For those functions that accept or return angles that may be given in either
degrees or radians (sin(x), cos(x), tan(x), asin(x), acos(x), atan(x),
atan2(x) and arg(z)), the unit may be selected by `set angles`, which
defaults to radians.
@start table
#\begin{tabular}{|ccl|} \hline
#\multicolumn{3}{|c|}{Math library functions} \\ \hline \hline
#Function & Arguments & Returns \\ \hline
%c c l .
%Function@Arguments@Returns
%_
4 abs
?expressions functions abs
?functions abs
?abs
#abs(x) & any & absolute value of $x$, $|x|$; same type \\
#abs(x) & complex & length of $x$, $\sqrt{{\mbox{real}(x)^{2} +
#\mbox{imag}(x)^{2}}}$ \\
%abs(x)@any@absolute value of $x$, $|x|$; same type
%abs(x)@complex@length of $x$, $sqrt{roman real (x) sup 2 + roman imag (x) sup 2}$
The `abs(x)` function returns the absolute value of its argument. The
returned value is of the same type as the argument.
For complex arguments, abs(x) is defined as the length of x in the complex
plane [i.e., sqrt(real(x)**2 + imag(x)**2) ].
4 acos
?expressions functions acos
?functions acos
?acos
#acos(x) & any & $\cos^{-1} x$ (inverse cosine) \\
%acos(x)@any@$cos sup -1 x$ (inverse cosine)
The `acos(x)` function returns the arc cosine (inverse cosine) of its
argument. `acos` returns its argument in radians or degrees, as selected by
`set angles`.
4 acosh
?expressions functions acosh
?functions acosh
?acosh
#acosh(x) & any & $\cosh^{-1} x$ (inverse hyperbolic cosine) in radians \\
%acosh(x)@any@$cosh sup -1 x$ (inverse hyperbolic cosine) in radians
The `acosh(x)` function returns the inverse hyperbolic cosine of its argument
in radians.
4 arg
?expressions functions arg
?functions arg
?arg
#arg(x) & complex & the phase of $x$ \\
%arg(x)@complex@the phase of $x$
The `arg(x)` function returns the phase of a complex number in radians or
degrees, as selected by `set angles`.
4 asin
?expressions functions asin
?functions asin
?asin
#asin(x) & any & $\sin^{-1} x$ (inverse sin) \\
%asin(x)@any@$sin sup -1 x$ (inverse sin)
The `asin(x)` function returns the arc sin (inverse sin) of its argument.
`asin` returns its argument in radians or degrees, as selected by `set
angles`.
4 asinh
?expressions functions asinh
?functions asinh
?asinh
#asinh(x) & any & $\sinh^{-1} x$ (inverse hyperbolic sin) in radians \\
%asinh(x)@any@$sinh sup -1 x$ (inverse hyperbolic sin) in radians
The `asinh(x)` function returns the inverse hyperbolic sin of its argument in
radians.
4 atan
?expressions functions atan
?functions atan
?atan
#atan(x) & any & $\tan^{-1} x$ (inverse tangent) \\
%atan(x)@any@$tan sup -1 x$ (inverse tangent)
The `atan(x)` function returns the arc tangent (inverse tangent) of its
argument. `atan` returns its argument in radians or degrees, as selected by
`set angles`.
4 atan2
?expressions functions atan2
?functions atan2
?atan2
#atan2(y,x) & int or real & $\tan^{-1} (y/x)$ (inverse tangent) \\
%atan2(y,x)@int or real@$tan sup -1 (y/x)$ (inverse tangent)
The `atan2(y,x)` function returns the arc tangent (inverse tangent) of the
ratio of the real parts of its arguments. `atan2` returns its argument in
radians or degrees, as selected by `set angles`, in the correct quadrant.
4 atanh
?expressions functions atanh
?functions atanh
?atanh
#atanh(x) & any & $\tanh^{-1} x$ (inverse hyperbolic tangent) in radians \\
%atanh(x)@any@$tanh sup -1 x$ (inverse hyperbolic tangent) in radians
The `atanh(x)` function returns the inverse hyperbolic tangent of its
argument in radians.
4 besj0
?expressions functions besj0
?functions besj0
?besj0
#besj0(x) & int or real & $j_{0}$ Bessel function of $x$, in radians \\
%besj0(x)@int or real@$j sub 0$ Bessel function of $x$, in radians
The `besj0(x)` function returns the j0th Bessel function of its argument.
`besj0` expects its argument to be in radians.
4 besj1
?expressions functions besj1
?functions besj1
?besj1
#besj1(x) & int or real & $j_{1}$ Bessel function of $x$, in radians \\
%besj1(x)@int or real@$j sub 1$ Bessel function of $x$, in radians
The `besj1(x)` function returns the j1st Bessel function of its argument.
`besj1` expects its argument to be in radians.
4 besy0
?expressions functions besy0
?functions besy0
?besy0
#besy0(x) & int or real & $y_{0}$ Bessel function of $x$, in radians \\
%besy0(x)@int or real@$y sub 0$ Bessel function of $x$, in radians
The `besy0` function returns the y0th Bessel function of its argument.
`besy0` expects its argument to be in radians.
4 besy1
?expressions functions besy1
?functions besy1
?besy1
#besy1(x) & int or real & $y_{1}$ Bessel function of $x$, in radians \\
%besy1(x)@int or real@$y sub 1$ Bessel function of $x$, in radians
The `besy1(x)` function returns the y1st Bessel function of its argument.
`besy1` expects its argument to be in radians.
4 ceil
?expressions functions ceil
?functions ceil
?ceil
#ceil(x) & any & $\lceil x \rceil$, smallest integer not less than $x$
#(real part) \\
%ceil(x)@any@$left ceiling x right ceiling$, smallest integer not less than $x$ (real part)
The `ceil(x)` function returns the smallest integer that is not less than its
argument. For complex numbers, `ceil` returns the smallest integer not less
than the real part of its argument.
4 cos
?expressions functions cos
?functions cos
?cos
#cos(x) & any & $\cos x$, cosine of $x$ \\
%cos(x)@radians@$cos~x$, cosine of $x$
The `cos(x)` function returns the cosine of its argument. `cos` accepts its
argument in radians or degrees, as selected by `set angles`.
4 cosh
?expressions functions cosh
?functions cosh
?cosh
#cosh(x) & any & $\cosh x$, hyperbolic cosine of $x$ in radians \\
%cosh(x)@any@$cosh~x$, hyperbolic cosine of $x$ in radians
The `cosh(x)` function returns the hyperbolic cosine of its argument. `cosh`
expects its argument to be in radians.
4 erf
?expressions functions erf
?functions erf
?erf
#erf(x) & any & $\mbox{erf}(\mbox{real}(x))$, error function of real($x$) \\
%erf(x)@any@$erf ( roman real (x))$, error function of real ($x$)
The `erf(x)` function returns the error function of the real part of its
argument. If the argument is a complex value, the imaginary component is
ignored.
4 erfc
?expressions functions erfc
?functions erfc
?erfc
#erfc(x) & any & $\mbox{erfc}(\mbox{real}(x))$, 1.0 - error function of real($x$) \\
%erfc(x)@any@$erfc ( roman real (x))$, 1.0 - error function of real ($x$)
The `erfc(x)` function returns 1.0 - the error function of the real part of
its argument. If the argument is a complex value, the imaginary component is
ignored.
4 exp
?expressions functions exp
?functions exp
?exp
#exp(x) & any & $e^{x}$, exponential function of $x$ \\
%exp(x)@any@$e sup x$, exponential function of $x$
The `exp(x)` function returns the exponential function of its argument (`e`
raised to the power of its argument). On some implementations (notably
suns), exp(-x) returns undefined for very large x. A user-defined function
like safe(x) = x<-100 ? 0 : exp(x) might prove useful in these cases.
4 floor
?expressions functions floor
?functions floor
?floor
#floor(x) & any & $\lfloor x \rfloor$, largest integer not greater
#than $x$ (real part) \\
%floor(x)@any@$left floor x right floor$, largest integer not greater than $x$ (real part)
The `floor(x)` function returns the largest integer not greater than its
argument. For complex numbers, `floor` returns the largest integer not
greater than the real part of its argument.
4 gamma
?expressions functions gamma
?functions gamma
?gamma
#gamma(x) & any & $\mbox{gamma}(\mbox{real}(x))$, gamma function of real($x$) \\
%gamma(x)@any@$GAMMA ( roman real (x))$, gamma function of real ($x$)
The `gamma(x)` function returns the gamma function of the real part of its
argument. For integer n, gamma(n+1) = n!. If the argument is a complex
value, the imaginary component is ignored.
4 ibeta
?expressions functions ibeta
?functions ibeta
?ibeta
#ibeta(p,q,x) & any & $\mbox{ibeta}(\mbox{real}(p,q,x))$, ibeta function of real($p$,$q$,$x$) \\
%ibeta(p,q,x)@any@$ibeta ( roman real (p,q,x))$, ibeta function of real ($p$,$q$,$x$)
The `ibeta(p,q,x)` function returns the incomplete beta function of the real
parts of its arguments. p, q > 0 and x in [0:1]. If the arguments are
complex, the imaginary components are ignored.
4 inverf
?expressions functions inverf
?functions inverf
?inverf
#inverf(x) & any & inverse error function of real($x$) \\
%inverf(x)@any@inverse error function real($x$)
The `inverf(x)` function returns the inverse error function of the real part
of its argument.
4 igamma
?expressions functions igamma
?functions igamma
?igamma
#igamma(a,x) & any & $\mbox{igamma}(\mbox{real}(a,x))$, igamma function of real($a$,$x$) \\
%igamma(a,x)@any@$igamma ( roman real (a,x))$, igamma function of real ($a$,$x$)
The `igamma(a,x)` function returns the incomplete gamma function of the real
parts of its arguments. a > 0 and x >= 0. If the arguments are complex,
the imaginary components are ignored.
4 imag
?expressions functions imag
?functions imag
?imag
#imag(x) & complex & imaginary part of $x$ as a real number \\
%imag(x)@complex@imaginary part of $x$ as a real number
The `imag(x)` function returns the imaginary part of its argument as a real
number.
4 invnorm
?expressions functions invnorm
?functions invnorm
?invnorm
#invnorm(x) & any & inverse normal distribution function of real($x$) \\
%invnorm(x)@any@inverse normal distribution function real($x$)
The `invnorm(x)` function returns the inverse normal distribution function of
the real part of its argument.
4 int
?expressions functions int
?functions int
?int
#int(x) & real & integer part of $x$, truncated toward zero \\
%int(x)@real@integer part of $x$, truncated toward zero
The `int(x)` function returns the integer part of its argument, truncated
toward zero.
4 lgamma
?expressions functions lgamma
?functions lgamma
?lgamma
#lgamma(x) & any & $\mbox{lgamma}(\mbox{real}(x))$, lgamma function of real($x$) \\
%lgamma(x)@any@$lgamma ( roman real (x))$, lgamma function of real ($x$)
The `lgamma(x)` function returns the natural logarithm of the gamma function
of the real part of its argument. If the argument is a complex value, the
imaginary component is ignored.
4 log
?expressions functions log
?functions log
?log
#log(x) & any & $\log_{e} x$, natural logarithm (base $e$) of $x$ \\
%log(x)@any@$ln~x$, natural logarithm (base $e$) of $x$
The `log(x)` function returns the natural logarithm (base `e`) of its
argument.
4 log10
?expressions functions log10
?functions log10
?log10
#log10(x) & any & $\log_{10} x$, logarithm (base $10$) of $x$ \\
%log10(x)@any@${log sub 10}~x$, logarithm (base $10$) of $x$
The `log10(x)` function returns the logarithm (base 10) of its argument.
4 norm
?expressions functions norm
?functions norm
?norm
#norm(x) & any & normal distribution (Gaussian) function of real($x$) \\
%norm(x)@any@$norm(x)$, normal distribution function of real($x$)
The `norm(x)` function returns the normal distribution function (or Gaussian)
of the real part of its argument.
4 rand
?expressions functions rand
?functions rand
?rand
#rand(x) & any & $\mbox{rand}(\mbox{real}(x))$, pseudo random number generator \\
%rand(x)@any@$rand ( roman real (x))$, pseudo random number generator
The `rand(x)` function returns a pseudo random number in the interval [0:1]
using the real part of its argument as a seed. If seed < 0, the sequence
is (re)initialized. If the argument is a complex value, the imaginary
component is ignored.
4 real
?expressions functions real
?functions real
?real
#real(x) & any & real part of $x$ \\
%real(x)@any@real part of $x$
The `real(x)` function returns the real part of its argument.
4 sgn
?expressions functions sgn
?functions sgn
?sgn
#sgn(x) & any & 1 if $x>0$, -1 if $x<0$, 0 if $x=0$. imag($x$) ignored \\
%sgn(x)@any@1 if $x > 0$, -1 if $x < 0$, 0 if $x = 0$. $roman imag (x)$ ignored
The `sgn(x)` function returns 1 if its argument is positive, -1 if its
argument is negative, and 0 if its argument is 0. If the argument is a
complex value, the imaginary component is ignored.
4 sin
?expressions functions sin
?functions sin
?sin
#sin(x) & any & $\sin x$, sine of $x$ \\
%sin(x)@any@$sin~x$, sine of $x$
The `sin(x)` function returns the sine of its argument. `sin` expects its
argument to be in radians or degrees, as selected by `set angles`.
4 sinh
?expressions functions sinh
?functions sinh
?sinh
#sinh(x) & any & $\sinh x$, hyperbolic sine $x$ in radians \\
%sinh(x)@any@$sinh~x$, hyperbolic sine $x$ in radians
The `sinh(x)` function returns the hyperbolic sine of its argument. `sinh`
expects its argument to be in radians.
4 sqrt
?expressions functions sqrt
?functions sqrt
?sqrt
#sqrt(x) & any & $\sqrt{x}$, square root of $x$ \\
%sqrt(x)@any@$sqrt x $, square root of $x$
The `sqrt(x)` function returns the square root of its argument.
4 tan
?expressions functions tan
?functions tan
?tan
#tan(x) & any & $\tan x$, tangent of $x$ \\
%tan(x)@any@$tan~x$, tangent of $x$
The `tan(x)` function returns the tangent of its argument. `tan` expects
its argument to be in radians or degrees, as selected by `set angles`.
4 tanh
?expressions functions tanh
?functions tanh
?tanh
#tanh(x) & any & $\tanh x$, hyperbolic tangent of $x$ in radians\\
%tanh(x)@any@$tanh~x$, hyperbolic tangent of $x$ in radians
The `tanh(x)` function returns the hyperbolic tangent of its argument. `tanh`
expects its argument to be in radians.
@end table
A few additional functions are also available.
@start table
#\begin{tabular}{|ccl|} \hline
#\multicolumn{3}{|c|}{other {\bf gnuplot} functions} \\ \hline \hline
#Function & Arguments & Returns \\ \hline
%c c l .
%Function@Arguments@Returns
%_
4 column
?expressions functions column
?functions column
?column
#column(x) & int & column $x$ during datafile manipulation. \\
%column(x)@int@ column $x$ during datafile manipulation.
`column(x)` may be used only in expressions as part of `using` manipulations
to fits or datafile plots. See `plot datafile using`.
4 tm_hour
?expressions tm_hour
?functions tm_hour
#tm\_hour(x) & int & the hour \\
%tm_hour(x)@int@the hour
The `tm_hour` function interprets its argument as a time, in seconds from
1 Jan 2000. It returns the hour (an integer in the range 0--23) as a real.
4 tm_mday
?expressions tm_mday
?functions tm_mday
#tm\_mday(x) & int & the day of the month \\
%tm_mday(x)@int@the day of the month
The `tm_mday` function interprets its argument as a time, in seconds from
1 Jan 2000. It returns the day of the month (an integer in the range 1--31)
as a real.
4 tm_min
?expressions tm_min
?functions tm_min
#tm\_min(x) & int & the minute \\
%tm_min(x)@int@the minute
The `tm_min` function interprets its argument as a time, in seconds from
1 Jan 2000. It returns the minute (an integer in the range 0--59) as a real.
4 tm_mon
?expressions tm_mon
?functions tm_mon
#tm\_mon(x) & int & the month \\
%tm_mon(x)@int@the month
The `tm_mon` function interprets its argument as a time, in seconds from
1 Jan 2000. It returns the month (an integer in the range 0--11) as a real.
4 tm_sec
?expressions tm_sec
?functions tm_sec
#tm\_sec(x) & int & the second \\
%tm_sec(x)@int@the second
The `tm_sec` function interprets its argument as a time, in seconds from
1 Jan 2000. It returns the second (an integer in the range 0--59) as a real.
4 tm_wday
?expressions tm_wday
?functions tm_wday
#tm\_wday(x) & int & the day of the week \\
%tm_wday(x)@int@the day of the week
The `tm_wday` function interprets its argument as a time, in seconds from
1 Jan 2000. It returns the day of the week (an integer in the range 0--6) as
a real.
4 tm_yday
?expressions tm_yday
?functions tm_yday
#tm\_yday(x) & int & the day of the year \\
%tm_yday(x)@int@the day of the year
The `tm_yday` function interprets its argument as a time, in seconds from
1 Jan 2000. It returns the day of the year (an integer in the range 1--366)
as a real.
4 tm_year
?expressions tm_year