-
Notifications
You must be signed in to change notification settings - Fork 5
/
FAQ
1397 lines (1054 loc) · 58.6 KB
/
FAQ
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
Gnuplot FAQ
This document deals with gnuplot version 4.2 which is the latest official
release as of September 2006.
Its version is $Revision: 1.17 $, dated $Date: 2007/02/17 20:34:05 $.
Contents
* 0 Meta - Questions
* 0.1 Where do I get this document?
* 0.2 Where do I send comments about this document?
* 1 General Information
* 1.1 What is gnuplot?
* 1.2 How did it come about and why is it called gnuplot?
* 1.3 What does gnuplot offer?
* 1.4 Is gnuplot suitable for scripting?
* 1.5 Can I run gnuplot on my computer?
* 1.6 Legalities
* 1.7 Does gnuplot have anything to do with the FSF and the GNU
project?
* 1.8 Where do I get further information?
* 2 Setting it up
* 2.1 What is the current version of gnuplot?
* 2.2 Where can I get gnuplot?
* 2.3 Where can I get current development version of gnuplot?
* 2.4 How do I get gnuplot to compile on my system?
* 2.5 What documentation is there, and how do I get it?
* 2.6 Worked examples
* 2.7 How do I modify gnuplot, and apply 'patches'?
* 3 Working with it.
* 3.1 How do I get help?
* 3.2 How do I print out my graphs?
* 3.3 How do I include my graphs in <word processor>?
* 3.4 How do I edit or post-process a gnuplot graph?
* 3.5 How do I change symbol size, line thickness and the like?
* 3.6 How do I generate plots in GIF format?
* 3.7 Can I animate my graphs?
* 3.8 How do I plot implicit defined graphs?
* 3.9 How to fill an area between two curves
* 3.10 Pm3d splot from a datafile does not draw anything
* 3.11 Drawing a (color) map, i.e. 2D projection of 3D data
* 3.12 How to overlay dots/points scatter plot onto a pm3d
map/surface
* 3.13 How to draw black contour plot, and contours with labels
* 3.14 How to overlay contour plot over pm3d map/surface
* 3.15 Color facets with pm3d
* 3.16 Palette for printing my color map on color as well as
black&white printer?
* 4 Wanted features
* 4.1 What's new in gnuplot 3.7, 4.0, 4.2 etc?
* 4.2 Does gnuplot support a driver for <graphics format>?
* 4.3 Does gnuplot have hidden line removal?
* 4.4 Does gnuplot support bar-charts/histograms/boxes?
* 4.5 Does gnuplot support pie charts?
* 4.6 Does gnuplot quarterly time charts?
* 4.7 Can I put multiple pages on one page?
* 4.8 Does gnuplot support multiple y-axes on a single plot?
* 4.9 Can I put both commands and data into a single file?
* 4.10 Can I put Greek letters and super/subscripts into my labels?
* 4.11 How do I include accented characters
* 4.12 Can I do 1:1 scaling of axes?
* 4.13 Can I put different text sizes into my plots?
* 4.14 How do I skip data points?
* 4.15 How do I plot every nth point?
* 4.16 How do I plot a vertical line?
* 4.17 How do I plot data files
* 4.18 How do I replot multiplot drawing
* 5 Miscellaneous
* 5.1 I've found a bug, what do I do?
* 5.2 Can I use gnuplot routines for my own programs?
* 5.3 What extensions have people made to gnuplot? Where can I get
them?
* 5.4 I need an integration, fft, iir-filter,...!
* 5.5 Can I do heavy-duty data processing with gnuplot? or What is
beyond gnuplot?
* 5.6 Mouse in my interactive terminal does not work
* 5.7 How to use hotkeys in my interactive terminals
* 5.8 I have ported gnuplot to another system, or patched it. What
do I do?
* 5.9 I want to help in developing the next version of gnuplot.
What can I do?
* 5.10 Open questions for inclusion into the FAQ?
* 6 Making life easier
* 6.1 How do I plot two functions in non-overlapping regions?
* 6.2 How do I run my data through a filter before plotting?
* 6.3 How do I make it easier to use gnuplot with LATEX?
* 6.4 How do I save and restore my settings?
* 6.5 How do I plot lines (not grids) using splot?
* 6.6 How do I plot a function f(x,y) that is bounded by other
functions in the x-y plane?
* 6.7 How do I turn off <feature> in a plot?
* 6.8 How do I call gnuplot from my own programs?
* 6.9 What if I need h-bar (Planck's constant)?
* 6.10 What if I need the Solar mass symbol?
* 6.11 How do a produce blank output page?
* 7 Common problems
* 7.1 Gnuplot is not plotting any points under X11! How come?
* 7.2 My isoline data generated by a Fortran program is not handled
correctly. What can I do?
* 7.3 Why does gnuplot ignore my very small numbers?
* 7.4 Gnuplot is not plotting on the screen when run from command
line via 'gnuplot filename.gp'
* 7.5 My formulas (like 1/3) are giving me nonsense results! What's
going on?
* 7.6 Set output 'filename' isn't outputting everything it should!
* 7.7 When using the LATEX-terminal, there is an error during the
LATEX-run!
* 7.8 The exit command does not work as documented!
* 7.9 I can't find the demos and example files at the URLs in the
documentation!
* 7.10 Calling gnuplot in a pipe or with a gnuplot-script doesn't
produce a plot!
* 8 Credits
0 Meta - Questions
0.1 Where do I get this document?
The newest version of this document is on the web at
http://www.gnuplot.info/faq/.
This document was/is posted sometimes to the newsgroups
~comp.graphics.apps.gnuplot.
0.2 Where do I send comments about this document?
Send comments, suggestions etc via email to the developer mailing list
[email protected]. Please contribute your suggestions
with respect to the file faq.tex available from
http://cvs.sourceforge.net/viewcvs.py/gnuplot/faq/.
1 General Information
1.1 What is gnuplot?
gnuplot is a command-driven interactive function plotting program. It can
be used to plot functions and data points in both two- and
three-dimensional plots in many different formats. It is designed
primarily for the visual display of scientific data. gnuplot is
copyrighted, but freely distributable; you don't have to pay for it.
1.2 How did it come about and why is it called gnuplot?
The authors of gnuplot are: Thomas Williams, Colin Kelley, Russell Lang,
Dave Kotz, John Campbell, Gershon Elber, Alexander Woo and many others.
The following quote comes from Thomas Williams:
I was taking a differential equation class and Colin was taking
Electromagnetics, we both thought it'd be helpful to visualize the
mathematics behind them. We were both working as sys admin for an EE
VLSI lab, so we had the graphics terminals and the time to do some
coding. The posting was better received than we expected, and prompted
us to add some, albeit lame, support for file data.
Any reference to GNUplot is incorrect. The real name of the program is
"gnuplot". You see people use "Gnuplot" quite a bit because many of us
have an aversion to starting a sentence with a lower case letter, even
in the case of proper nouns and titles. gnuplot is not related to the
GNU project or the FSF in any but the most peripheral sense. Our
software was designed completely independently and the name "gnuplot"
was actually a compromise. I wanted to call it "llamaplot" and Colin
wanted to call it "nplot." We agreed that "newplot" was acceptable but,
we then discovered that there was an absolutely ghastly pascal program
of that name that the Computer Science Dept. occasionally used. I
decided that "gnuplot" would make a nice pun and after a fashion Colin
agreed.
1.3 What does gnuplot offer?
* Plotting two-dimensional functions and data points in many different
styles (points, lines, error bars)
* Plotting three-dimensional data points and surfaces in many different
styles (contour plot, mesh)
* Algebraic computation in integer, float and complex arithmetic
* User-defined functions and hot-keys
* Support for a large number of operating systems, graphics file formats
and output devices
* Extensive on-line help
* TEX-like text formatting for labels, titles, axes, data points
* Interactive command line editing and history (most platforms)
1.4 Is gnuplot suitable for scripting?
Yes. Gnuplot can read in files containing additional commands during an
interactive session, or it can be run in batch mode by piping a
pre-existing file or a stream of commands to stdin. Gnuplot is used as a
back-end graphics driver by such higher-level mathematical packages as
Octave, and can easily be wrapped in a cgi script for use as a web-driven
plot generator.
1.5 Can I run gnuplot on my computer?
Gnuplot is available for a number of platforms. These are: Unix (X11 and
NeXTSTEP), Linux, VMS, OS/2, MS-DOS, Amiga, MS-Windows, OS-9/68k, Atari
ST, BeOS, and Macintosh.
Please notify the FAQ-maintainer of any further ports you might be aware
of.
You should be able to compile the gnuplot source more or less out of the
box on any reasonable standard (ANSI/ISO C, POSIX) environment.
1.6 Legalities
Gnuplot is freeware authored by a collection of volunteers, who cannot
make any legal statement about the compliance or non-compliance of gnuplot
or its uses. There is also no warranty whatsoever. Use at your own risk.
Citing from the README of a mathematical subroutine package by R. Freund:
For all intent and purpose, any description of what the codes are doing
should be construed as being a note of what we thought the codes did on
our machine on a particular Tuesday of last year. If you're really
lucky, they might do the same for you someday. Then again, do you really
feel *that* lucky?
1.7 Does gnuplot have anything to do with the FSF and the GNU project?
Gnuplot is neither written nor maintained by the FSF. It is not covered by
the General Public License, either. It used to be distributed by the FSF,
however, due to licensing issues it is no longer.
Gnuplot is freeware in the sense that you don't have to pay for it.
However it is not freeware in the sense that you would be allowed to
distribute a modified version of your gnuplot freely. Please read and
accept the Copyright file in your distribution.
1.8 Where do I get further information?
See the main gnuplot web page http://www.gnuplot.info and references
therein, mainly gnuplot links http://gnuplot.sourceforge.net/links.html.
Some documentation and tutorials are available in other languages than
English. See http://gnuplot.sourceforge.net/help.html, section "Localized
learning pages about gnuplot", for the most up-to-date list.
2 Setting it up
2.1 What is the current version of gnuplot?
The current released version of gnuplot is 4.0.
2.2 Where can I get gnuplot?
The best place is definitely http://www.gnuplot.info. From there you find
various pointers to other sites.
The source distribution ("gnuplot-4.0.0.tar.gz" or a similar name) is
available from the official distribution site and its mirrors.
The main server is ftp.gnuplot.info in /pub/gnuplot/. This server is
mirrored by several others, among those are
* mirror.aarnet.edu.au in /pub/gnuplot/
* ftp.dartmouth.edu in /pub/gnuplot/
* ftp.irisa.fr in /pub/gnuplot/
* ftp.gnuplot.vt.edu in /pub/gnuplot/
As of June 1999, the gnuplot distribution is also mirrored at the
Comprehensive TeX Archive Network (CTAN) in the graphics/gnuplot
directory. See
* http://www.ctan.org/.
The following platform-specific sites below still exist, but may or may
not still hold gnuplot executables.
* Source and binary distributions for the Amiga are available on Aminet
ftp.wustl.edu in aminet/ and its mirrors, for example ftp.uni-kl.de,
oes.orst.edu or ftp.luth.se.
* MS-DOS and MS-Windows binaries are available from the above servers
and are called for example gp37dos.zip, gp37dj.zip, gp37w16.zip,
gp37mgw.zip, gnuplot3.7cyg.zip. OS/2 binaries are called gp37os2.zip.
* The NeXTSTEP front end can be found at next-ftp.peak.org in
/pub/next/binaries/plotting/Gnuplot1.2_bin.tar.Z.
* A version for OS-9/68K can be found at cabrales.cs.wisc.edu in
/pub/OSK/GRAPHICS/gnuplot32x.tar.Z; it includes both an X-Window
Systems and a non - X-Window Systems version.
* Versions for the Atari ST and TT, which include some GEM windowing
support, are available from ftp.uni-kl.de in /pub/atari/graphics/, as
gplt35st.zip and gplt35tt.zip. They work best under MiNT.
* Executable files, plus documentation in Japanese, exist for the X680x0
on ftp.csis.oita-u.ac.jp in /pub/x68k/fj.binaries.x68000/vol2.
2.3 Where can I get current development version of gnuplot?
The development version of gnuplot is availble as a cvs source tree online
for direct browsing from http://www.sourceforge.net/projects/gnuplot/,
section "CVS". You can download all current sources according to the
documentation therein; for example by a sequence of commands like
cvs -d:pserver:[email protected]:/cvsroot/gnuplot login
cvs -z3 -d:pserver:[email protected]:/cvsroot/gnuplot co -P gnuplot
or (in bash)
export CVSROOT=:pserver:[email protected]:/cvsroot/gnuplot
cvs login
cvs -z3 checkout gnuplot
Further, before the ./configure command of gnuplot compilation phase, you
have to execute ./prepare to create the up-to-date configure files.
There are no official preliminary binary releases of gnuplot: you have to
compile it yourself. However, you may find unofficial binary releases for
some platforms, like OS/2, Windows or Macintosh.
Important note: questions related to the development version should go to
2.4 How do I get gnuplot to compile on my system?
As you would any other installation. Read the files README.1ST and README.
* For Unix, use ./configure (or ./configure -prefix=$HOME/usr for an
installation for a single user), make and finally make install or make
install-strip, the latter for smaller executables without debugging
information. If you want to make a RPM package, then replace the
latest step by checkinstall or checkinstall make install-strip,
supposing the package checkinstall on your machine.
* For DOS, if you are using bash and DJGPP, you can just run
djconfig.sh.
* For other platforms, copy the relevant makefile (e.g. makefile.os2 for
OS/2, or makefile.mgw or makefile.cyg for Windows) from config/ to
src/, optionally update options in the makefile's header, then change
directory to src and run make.
2.5 What documentation is there, and how do I get it?
The documentation is included in the source distribution. Look at the docs
subdirectory, where you'll find
* a Unix man page, which says how to start gnuplot
* a help file, which also can be printed as a manual
* a tutorial on using gnuplot with LATEX
* a quick reference summary sheet for TEX only
The documentation is built during installation if you have LATEX installed
on your system, look in the directories docs and tutorial. make pdf in the
docs subdirectory will make a gnuplot.pdf hypertext file ready for
browsing or printing.
Online gnuplot documentation is available at
http://gnuplot.sourceforge.net/documentation.html.
(Obsolete?) PostScript copies of the documentation can be ftp'd from
ftp.gnuplot.info in /pub/gnuplot, as manual.ps.Z and tutorial.ps.Z.
Documentation about gnuplot is available at the gnuplot distribution sites
in the files gpdoc.zip and gpdoc2.zip.
2.6 Worked examples
There is a directory of worked examples in the the source distribution.
These examples, and the resulting plots, may also be found at
http://gnuplot.sourceforge.net/demo/.
2.7 How do I modify gnuplot, and apply 'patches'?
For this, you will need to recompile gnuplot.
Modifications people make are either done by replacing files, such as
terminal drivers, or by 'patching'. If a file is a replacement, it will
probably tell you in its README or in the lines at the beginning.
To patch a file, you need the patch utility, and possibly also automake
and autoconf. On many UNIX systems these will already be installed; If
they aren't, you can find them wherever GNU software is archived. Typical
command for applying a patch is patch -p0 <newfunctionality.diff.
There is repository of contributed patches in the "Patches" section on
gnuplot's sourceforge site http://www.sourceforge.net/projects/gnuplot/.
3 Working with it.
3.1 How do I get help?
Read this document.
Give the help command at the initial prompt. After that, keep looking
through the keywords. Good starting points are plot and set.
Read the manual, if you have it.
Look through the demo subdirectory; it should give you some ideas.
Ask your colleagues, the system administrator or the person who set up
gnuplot.
If all these fail, please upgrade to the newest version of gnuplot or urge
your system-administrator to do so. Then post a question
to ~comp.graphics.apps.gnuplot or send mail to the gatewayed mailing list
[email protected]. Do not forget to cite the version
number and the operating system. If you want to subscribe to the mailing
list, send a mail to [email protected] with the body of the
message being subscribe info-gnuplot. Please don't do this if you can get
~comp.graphics.apps.gnuplot directly. If you post a question there, it is
considered good form to solicit e-mail replies and post a summary.
3.2 How do I print out my graphs?
The kind of output produced is determined by the set terminal command; for
example, set terminal postscript will produce the graph in PostScript
format. Output can be redirected using the set output command.
As an example, the following prints out a graph of sin(x) on a Unix
machine running the X-Window System.
gnuplot> plot [-6:6] sin(x)
gnuplot> set terminal postscript
Terminal type set to 'postscript'
Options are 'landscape monochrome "Courier" 14'
gnuplot> set output "sin.ps"
gnuplot> replot
gnuplot> set output # set output back to default
gnuplot> set terminal x11 # ditto for terminal type
gnuplot> ! lp -ops sin.ps # print PS File (site dependent)
request id is lprint-3433 (standard input)
lp: printed file sin.ps on fg20.rz.uni-karlsruhe.de (5068 Byte)
!
gnuplot>
Using the platform-independent way of restoring terminal by set term
push/pop commands, do it by
gnuplot> set terminal postscript eps color lw 15 "Helvetica" 20
gnuplot> set out 'a.eps'
gnuplot> replot
gnuplot> set term pop
The command set term pop without a previous corresponding set term push
switches the terminal back to the startup terminal, e.g. x11, pm or win.
In Microschrott Windows you click in the upper left corner of the graph
window and print directly from there.
3.3 How do I include my graphs in <word processor>?
Basically, you save your plot to a file in a format your word processor
can understand (using set term and set output, see above), and then you
read in the plot from your word processor. Vector formats (PostScript,
emf, svg, pdf, TEX, LATEX, etc) should be preferred, as you can scale your
graph later to the right size.
Details depend on which word processor you use; use set term to get a list
of available file formats.
Many word processors can use Encapsulated PostScript for graphs. This can
be generated by the set terminal postscript eps [color] command. Note that
it is a good idea to check and correct the bounding box of the graphs in
the eps files (manually or by the fixbb script from gnuplot webpage), as
you have to correct this box for any eps figure produced by whichever
program. Some (most?) word processors do not preview the actual image in
the eps file, and you have to add the preview image yourself. You can use
the GSView viewer for this (available for OS/2, Windows and X11), or some
Unix ps tool. Note that the preview image increases size of the eps file;
the smallest increase you may get by choosing Tiff 6 Packbits.
Into some office applications, like OpenOffice.org, or into applications
in the Windows world, you can insert vectorial images produces by the emf
terminal type. OpenOffice.org can also read AutoCAD's dxf format, as well
as SVG thanks to SVG Import Filter
http://www.ipd.uni-karlsruhe.de/ hauma/svg-import/.
With TEX, it depends on what you use to print your dvi files. If you use
dvips or dvi2ps, you can use Encapsulated PostScript. For emTeX (popular
for OS/2 and MS-DOS), you can use emTeX, otherwise use the LATEX terminal
type, which generates a picture environment. You can also use epslatex to
separate the graphics and text parts. Other possibilities include pslatex
or pstex terminals, and metafont or metapost terminals.
With TEX processed by pdftex or pdflatex, you can use png, jpeg and pdf
terminal types. You can also use the postscript eps terminal and convert
the eps file externally to pdf by epstopdf. Another choice is the epslatex
terminal, after converting the eps part to pdf as above (the TEX part can
remain unchanged).
Most word processors can import bitmap images (png, pbm, etc). The
disadvantage of this approach is that the resolution of your plot is
limited by the size of the plot at the time it is generated by gnuplot,
which is generally a much lower resolution than the document will
eventually be printed in.
Under IBM OS/2, MacOS and Micro$oft Windows you can use the clipboard to
copy your graph and paste it into your favourite word processor.
The mif terminal type produces output for FrameMaker.
3.4 How do I edit or post-process a gnuplot graph?
This depends on the terminal type you use.
* X11 toolkits: You can use the terminal type fig and use the xfig
drawing program to edit the plot afterwards. You can obtain the xfig
program from its web site http://www.xfig.org. More information about
the text-format used for fig can be found in the fig-package.
You may use the tgif terminal, which creates output suitable for
reading within tgif (http://bourbon.cs.umd.edu:8001/tgif/), an
interactive 2-D drawing tool under X11.
* You may use the svg terminal (scalable vector graphics), which can be
further edited by a svg editor, e.g. Inkscape
(http://www.inkscape.org), Sodipodi (http://sodipodi.sourceforge.net),
Sketch (http://sketch.sourceforge.net) or Dia
(http://www.lysator.liu.se/ alla/dia), or loaded into OpenOffice.org
with an on-fly conversion into OO.o Draw primitives.
* PostScript or PDF output can be edited directly by tools such as Adobe
Illustrator or Acrobat, or can be converted to a variety of other
editable vector formats by the pstoedit package. Pstoedit is available
at http://www.pstoedit.net.
* The mif terminal type produces an editable FrameMaker document.
* The DXF format is the AutoCAD's format, editable by several other
applications.
* Bitmapped graphics (e.g. png, jpeg, pbm) can be edited using tools
such as ImageMagick or Gimp. In general, you should use a vector
graphics program to post-process vector graphic formats, and a
pixel-based editing program to post-process pixel graphics.
3.5 How do I change symbol size, line thickness and the like?
Gnuplot offers a variety of commands to set line and point properties,
including color, thickness, point shape, etc. The command test will
display a test page for the currently selected terminal type showing the
available pre-defined combinations of color, size, shape, etc. The set
style command can be used to define additional combinations.
3.6 How do I generate plots in GIF format?
GIF support is provided by an external library, libgd
(http://www.libgd.org). Old versions of gd (versions 1.2 to 1.4) produce
only GIF output. Versions 1.6 to 2.0.27 did not support GIF output because
of patent concerns. However versions 1.6 and newer support PNG outputs,
and 1.7 and newer support JPEG outputs. Version 2.0.28 of the Boutell gd
library restored GIF functionality, and 2.0.29 added support for GIF
animation. If your installation of gnuplotis linked to the gd library, you
will get support for whatever formats (GIF, PNG, JPEG) are in that version
of gd.
In any case, it is easy to convert from one format to another. To convert
a PNG output into GIF, you can either use the command line (e.g. convert
f.png f.gif or nconvert -out gif f.png) or any GUI program. Another
possibility is to output the image as (encapsulated) postscript and
convert (export) it into GIF or PNG by ghostscript, e.g. convert -density
150 f.eps f.gif or by any ghostscript-based GUI like gsview, gv or
kghostview.
3.7 Can I animate my graphs?
First have a look at animate.dem in the demo directory of gnuplot.
Basically, animated graphs are a sequence of plots in a suitable format.
If your installation of gnuplotis linked with gd 2.0.29 or newer (see
previous entry), the gif terminal can generate directly an animated GIF.
Otherwise, have a look at the tool whirlgif 3.04, available at
http://www.danbbs.dk/ dino/whirlgif. It reads run-length encoded GIF files
and packs them into a minimal animation. On the web-pages you will find a
manual and an example.
You can also write a small script to get gnuplot to output a family of GIF
files, then have it execute some animator such as gifsicle:
http://www.lcdf.org/ eddietwo/gifsicle or gifmerge
http://the-labs.com/GIFMerge.
mpeg_encode will encode a sequence of images into an mpeg format movie.
3.8 How do I plot implicit defined graphs?
Implicit graphs or curves cannot be plotted directly in gnuplot. However
there is a workaround.
gnuplot> # An example. Place your definition in the following line:
gnuplot> f(x,y) = y - x**2 / tan(y)
gnuplot> set contour base
gnuplot> set cntrparam levels discrete 0.0
gnuplot> unset surface
gnuplot> set table 'curve.dat'
gnuplot> splot f(x,y)
gnuplot> unset table
gnuplot> plot 'curve.dat' w l
The trick is to draw the single contour line z=0 of the surface z=f(x,y),
and store the resulting contour curve to a gnuplot datafile.
3.9 How to fill an area between two curves
A plot with filled area between two given curves requires a parametric
plot with filledcurves closed. The example below demonstrates this for two
curves f(x) and g(x) with a tricky "folded" parameter t:
set parametric
f(x)=cos(x)
g(x)=sin(x)
xmax=pi/4
set xrange [0:xmax]
set trange [0:2*xmax]
path(t) = ( t<= xmax ? f(t) : g(2*xmax-t) )
fold(t) = (t <=xmax ? t : 2*xmax - t)
plot fold(t),path(t) with filledcurves closed
Note that the above code fills area between the two curves, not area
satisfying inequality g(x)<f(x). If you want the latter, you should use
the ternary operator in path(t) to return an undefined value (0/0) if the
inequality is not satisfied.
See the documentation for help parametric, help filledcurves, and help
ternary.
3.10 Pm3d splot from a datafile does not draw anything
You do set pm3d; splot 'a.dat' and no plot but colorbox appears.
Obviously, there is no blank line in between two subsequent scans
(isolines) in the data file. Add blank lines! If you are curious what this
means, then don't hesitate to look to files like demo/glass.dat or
demo/triangle.dat in the gnuplot demo directory.
You can find useful the following awk script (call it e.g. addblanks.awk)
which adds blank lines to a data file whenever number in the first column
changes:
/^[[:blank:]]*#/ {next} # ignore comments (lines starting with #)
NF < 3 {next} # ignore lines which don't have at least 3 columns
$1 != prev {printf "\n"; prev=$1} # print blank line
{print} # print the line
Then, either preprocess your data file by command awk -f addblanks.awk
<a.dat or plot the datafile under a unixish platform by gnuplot> splot
"<awk -f addblanks.awk a.dat".
3.11 Drawing a (color) map, i.e. 2D projection of 3D data
Use set view map; unset surface or set pm3d map rather than set view
180,0. The latter facilitates drawing matrices or data files as maps, even
without the necessity for matrix-like data organization (gridding). It is
possible to decrease the output postscript file size by postprocessing it
by pm3dCompress.awk or pm3dConvertToImage.awk.
Note there is a new plotting style with image for plotting 2D color images
with support for almost arbitrary text or binary files in "Patches"
section on gnuplot's sourceforge site
http://www.sourceforge.net/projects/gnuplot/.
3.12 How to overlay dots/points scatter plot onto a pm3d map/surface
Use the explicit (see also implicit) switch of the pm3d style:
gnuplot> set pm3d explicit
gnuplot> splot x with pm3d, x*y with points
3.13 How to draw black contour plot, and contours with labels
Well, it is very simple even though it is hard to discover: unset clabel.
set contour both; set cntr levels 100
unset clabel
unset surface
splot x*y with line lt -1
pause -1
splot x*y with line palette
Another solution requires to write contours into a temporary file using
the table terminal:
set contour base; set cntrparam levels 15; unset surface; set view map
splot x*x+y*y; pause -1
set table 'contour.dat'
replot
unset table
Now, for drawing it in 2D, do
reset
plot 'contour.dat' with line -1
and for contours in 3D do
reset
# Change single blank lines to double blank lines
!awk "NF<2{printf\"\n\"}{print}" <contour.dat >contour1.dat
splot 'contour1.dat' with line -1
See also the following question "How to overlay contour plot over pm3d
map/surface".
Labelling contours by their z-value can be achieved by a suitable script
generating automatically the appropriate set label commands; you can find
one at gnuplot scripts page
http://gnuplot.sourceforge.net/scripts/index.html#tricks-here.
3.14 How to overlay contour plot over pm3d map/surface
This requires you to write contours into a temporary file using the table
terminal, and then use this file in the final drawing without set
contours. The following example demonstrates this for a map; for surface,
remove set pm3d map and put set ticslevel 0.
# Write contours of function x*x-y*y to a (temporary) file
set contour base; set cntrparam level 20
unset surface
set table 'contour.dat'
splot x*x-y*y
unset table
# Change single blank lines to double blank lines
!awk "NF<2{printf\"\n\"}{print}" <contour.dat >contour1.dat
# Draw the plot
reset
set palette gray
set palette gamma 2.5
set pm3d map
set pm3d explicit
splot x*x+y*y with pm3d, 'contour1.dat' with line lt -1
!rm contour.dat contour1.dat
The last command deletes the two temporary files.
3.15 Color facets with pm3d
It is possible to draw colors facets of a 3D objects, organized in such a
file:
# triangle 1
x0 y0 z0 <c0>
x1 y1 z1 <c1>
x2 y2 z2 <c2>
x2 y2 z2 <c2>
# triangle 2
x y z
...
Notice the positioning single and double blank line. <c> is an optional
color.
Then plot it by (either of splot's):
set pm3d
set style data pm3d
splot 'facets.dat'
splot 'facets_with_color.dat' using 1:2:3:4
Note that you avoid surface lines by set style data pm3d or splot ... with
pm3d.
In the above example, pm3d displays triangles as independent surfaces.
They are plotted one surface after another, as found in the data file.
Parts overlapping in 2D projection are overdrawn.
Gnuplot is not 3D modeling program. Its hidden routines apply for points
and lines, but not for faces. Without handling the data as a collection of
faces, there would be no surface anything could be hidden behind. The
'hidden3d' algorithm works by using the input data in two ways: first, to
set up a collection of triangles (made from a mesh of quadrangles) that
form the surface, second as a collection of edges. It then goes through
all those edges, checking what parts of them are not hidden behind any
faces, and draws those.
Consequently, gnuplot won't draw your surface or 3D object as a virtual
reality. It works OK for set pm3d map but for true 3D you would be
probably more happy writing a convertor of your facets into a VRML file.
3.16 Palette for printing my color map on color as well as black&white printer?
I think it is this one, for example: set palette rgbformulae -25,-24,-32.
Can somebody prove this?
4 Wanted features
4.1 What's new in gnuplot 3.7, 4.0, 4.2 etc?
Too many things to be named here. Please refer to the NEWS file in the
source distribution, or the "New features" section in the gnuplot
documentation.
4.2 Does gnuplot support a driver for <graphics format>?
To see a list of the available graphic drivers for your installation of
gnuplot, type set term.
Some graphics drivers are included in the normal distribution, but are
uncommented by default. If you want to use them, you'll have to change
file gnuplot/src/term.h, and recompile.
4.3 Does gnuplot have hidden line removal?
Yes.
4.4 Does gnuplot support bar-charts/histograms/boxes?
Various clustered and stacked histogram styles are supported in gnuplot
version 4.2 as separate style types.
In older gnuplotversions you can use the style with boxes for bar charts.
To get filled boxes, use set style fill. Bernhard Reiter wrote an AWK
script to post-process fig-terminal output. This may be useful with older
versions of gnuplot. Please have a look at
http://www.usf.uni-osnabrueck.de/ breiter/tools/gnuplot/barchart.en.html.
4.5 Does gnuplot support pie charts?
It's not possible in gnuplot, but have a look at
http://www.usf.uni-osnabrueck.de/ breiter/tools/piechart/piecharts.en.html
4.6 Does gnuplot quarterly time charts?
It's not possible in gnuplot, but have a look at
http://ricardo.ecn.wfu.edu/ cottrell/qplot. The corresponding file
qplot.zip can be obtained from the contrib directory on any gnuplot
server.
4.7 Can I put multiple pages on one page?
Yes. set multiplot.
If you use the postscript terminal and plot one graph per page you can use
the program mpage (http://www.mesa.nl/pub/mpage) to print multiple logical
pages per physical page. A similar program is the psnup program in the
psutils package. This package is available at any CTAN mirror.
4.8 Does gnuplot support multiple y-axes on a single plot?
Yes. You can have 2 x- and 2 y-axes per plot. The additional axes are
called x2 and y2. See help plot.
4.9 Can I put both commands and data into a single file?
This is possible by the new plot "-" possibility. The plot "-" command
allows to read the data to be plot from standard input or the current
batch job.
gnuplot> plot "-"
1 1
2 4
3 9
e
4.10 Can I put Greek letters and super/subscripts into my labels?
The enhanced option in some terminals (currently postscript, Presentation
Manager, png, pdf, and x11) lets you use sub- and superscripts. It also
allows to use Greek letters and symbols via symbol fonts, to the extent
that these are supported by the underlying font libraries on your system.
Versions through 2.0.15 of libgd (needed for png and jpeg) must be patched
in order to handle symbol fonts.
You might try using the LATEX terminal type and putting text like
"\\alpha_{3}" or '\alpha_{3}' . If you include your gnuplot-graphs into a
LATEX document you can use the LATEX-package psfrag to typeset any
characters into your graphs.
One more possibility is to use the MetaPost terminal. It supports TEX
syntax and is converted onto encapsulated PostScript by mpost.
4.11 How do I include accented characters
To obtain accented characters like u: or n in your labels you should use
8bit character codes together with the appropriate encoding option. See
the following example:
gnuplot> set encoding iso_8859_1
gnuplot> set title "M\374nchner Bierverbrauch \374ber die Jahre"
gnuplot> plot "bier.dat" u 1:2
Consequently, you can type labels in Czech, French, Hungarian, Russian...
by means of an appropriate set encoding. However, you cannot mix two
encodings in one file (e.g. accents for west and east latin encodings).
A more general solution is to use UTF-8 encoded fonts, and type the UTF-8
characters directly into gnuplot. This works for many terminal types but
not, unfortunately, PostScript.
4.12 Can I do 1:1 scaling of axes?
Use set size square.
4.13 Can I put different text sizes into my plots?
Some terminals can, others can't. Some allow you to choose a font size for
the entire plot. Terminals supporting the "enhanced text" mode (like
postscript, pm, x11, png, pdf) allow you to change fonts and text sizes
within a plot. Look at the help for these terminals.
4.14 How do I skip data points?
By specifying ? as a data value, as in
1 2
2 3
3 ?
4 5
See also set missing. See also set datafile commentschars for specifying
comment characters in data files.
4.15 How do I plot every nth point?
This can be specified with various options for the command plot, for
example plot 'a.dat' every 2.
4.16 How do I plot a vertical line?
Depending on context, the main methods are:
* set arrow .... .... nohead where you have to compute explicitly the
start and the end of the arrow.
* generate (inlined) datapoints and plot them
* switch to parametric mode
4.17 How do I plot data files
Easily: by a command plot 'a.dat'. In 3D, use splot 'a.dat' - but don't
forget to put a blank line in between two subsequent scans (isolines),
otherwise you will get an error that the data is not gridded; see also
question 3.10. If your data are not gridded, then use set dgrid3d {many
options}.
4.18 How do I replot multiplot drawing
You cannot directly: gnuplot supports replot command, not remultiplot. You
have to write the complete sequence of commands since set multiplot till
unset multiplot into a script file. Then you can load the script into
gnuplot as many times as you need for replotting the drawing to different
terminals or output files.
5 Miscellaneous
5.1 I've found a bug, what do I do?
First, try to see whether it actually is a bug, or whether it is a feature
which may be turned off by some obscure set-command.
Next, see whether you have an old version of gnuplot; if you do, chances
are the bug has been fixed in a newer release.
Fixes for bugs reported since the release of the current version are held
in the patches directory at gnuplot distribution sites. Before submitting
a bug report, please check whether the bug in question has already been
fixed.
If, after checking these things, you still are convinced that there is a
bug, proceed as follows. If you have a fairly general sort of bug report,
posting to ~comp.graphics.apps.gnuplot is probably the way to go. If you
have investigated a problem in detail, especially if you have a context or
unified diff that fixes the problem, please e-email a report to
The bug-gnuplot list is for reporting and collecting bug fixes, the
~comp.graphics.apps.gnuplot newsgroup will be more help for finding work
arounds or actually solving gnuplot related problems. If you do send in a
bug report, be sure and include the version of gnuplot (including
patchlevel) as shown by the command show version long, terminal driver,
operating system, an exact description of the bug and input which can
reproduce the bug. Failure to indicate these details can render a solution
to your problem almost impossible. Also, any context diffs should be
referenced against the latest official version of gnuplot if at all
possible.
5.2 Can I use gnuplot routines for my own programs?
On systems supporting pipes, you can pipe commands to gnuplot from other
programs. Many applications with gnuplot as the graphics engine, like
Octave (http://www.octave.org), uses this method. This also works from a
cgi script to drive gnuplot from a forms-based web page.
John Campbell ([email protected]) modified a much earlier version of
gnuplot (3.5) to be a library of C subroutines callable from a C program.
Gnuplot itself has changed radically since then, and we are not aware of
any plans to create a similar library based on the current version.
5.3 What extensions have people made to gnuplot? Where can I get them?
Many extensions or patches are available on the "Patches" page of the
gnuplot development site
http://sourceforge.net/tracker/?group_id=2055&atid=302055. The current
development version will generally include some of these being debugged
for inclusion in a later official release of gnuplot.
Older extensions, which may or may not work with the current version, are
available from ftp.ucc.ie in /pub/gnuplot/contrib/.
Some extensions available:
* date-errorbar: allows dates in the hi/lo fields for errorbars.
* perltk: A perl/tk canvas widget.
* polyg.patch: Implements a polygon plotting style.