"SfR Fresh" - the SfR Freeware/Shareware Archive 
Member "gnuplot/docs/FAQ.txt" of archive gp423win32.zip:
As a special service "SfR Fresh" has tried to format the requested source page into HTML format using source code syntax highlighting with prefixed line numbers.
Alternatively you can here view or download the uninterpreted source code file.
That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.
1 Gnuplot FAQ
2
3 This document deals with gnuplot version 4.2 which is the latest official
4 release as of March 2007.
5 Its version is $Revision: 1.32 $, dated $Date: 2007/03/12 17:43:14 $.
6
7 Contents
8
9 * 0 Meta - Questions
10 * 0.1 Where do I get this document?
11 * 0.2 Where do I send comments about this document?
12 * 1 General Information
13 * 1.1 What is gnuplot?
14 * 1.2 How did it come about and why is it called gnuplot?
15 * 1.3 What does gnuplot offer?
16 * 1.4 Is gnuplot suitable for scripting?
17 * 1.5 Can I run gnuplot on my computer?
18 * 1.6 Legalities
19 * 1.7 Does gnuplot have anything to do with the FSF and the GNU
20 project?
21 * 1.8 Where do I get further information?
22 * 2 Setting it up
23 * 2.1 What is the current version of gnuplot?
24 * 2.2 Where can I get gnuplot?
25 * 2.3 Where can I get current development version of gnuplot?
26 * 2.4 How do I get gnuplot to compile on my system?
27 * 2.5 What documentation is there, and how do I get it?
28 * 2.6 Worked examples
29 * 2.7 How do I modify gnuplot, and apply 'patches'?
30 * 3 Working with it.
31 * 3.1 How do I get help?
32 * 3.2 How do I print out my graphs?
33 * 3.3 How do I include my graphs in <word processor>?
34 * 3.4 How do I edit or post-process a gnuplot graph?
35 * 3.5 How do I change symbol size, line thickness and the like?
36 * 3.6 How do I generate plots in GIF format?
37 * 3.7 Can I animate my graphs?
38 * 3.8 How do I plot implicit defined graphs?
39 * 3.9 How to fill an area between two curves
40 * 3.10 Pm3d splot from a datafile does not draw anything
41 * 3.11 Drawing a (color) map, i.e. 2D projection of 3D data
42 * 3.12 How to overlay dots/points scatter plot onto a pm3d
43 map/surface
44 * 3.13 How to draw black contour plot, and contours with labels
45 * 3.14 How to overlay contour plot over pm3d map/surface
46 * 3.15 Color facets with pm3d
47 * 3.16 Palette for printing my color map on color as well as
48 black&white printer?
49 * 4 Wanted features
50 * 4.1 What's new in gnuplot 3.7, 4.0, 4.2 etc?
51 * 4.2 Does gnuplot support a driver for <graphics format>?
52 * 4.3 Does gnuplot have hidden line removal?
53 * 4.4 Does gnuplot support bar-charts/histograms/boxes?
54 * 4.5 Does gnuplot support pie charts?
55 * 4.6 Does gnuplot quarterly time charts?
56 * 4.7 Can I put multiple pages on one page?
57 * 4.8 Does gnuplot support multiple y-axes on a single plot?
58 * 4.9 Can I put both commands and data into a single file?
59 * 4.10 Can I put Greek letters and super/subscripts into my labels?
60 * 4.11 How do I include accented characters
61 * 4.12 Can I do 1:1 scaling of axes?
62 * 4.13 Can I put different text sizes into my plots?
63 * 4.14 How do I skip data points?
64 * 4.15 How do I plot every nth point?
65 * 4.16 How do I plot a vertical line?
66 * 4.17 How do I plot data files
67 * 4.18 How do I replot multiplot drawing
68 * 5 Miscellaneous
69 * 5.1 I've found a bug, what do I do?
70 * 5.2 Can I use gnuplot routines for my own programs?
71 * 5.3 What extensions have people made to gnuplot? Where can I get
72 them?
73 * 5.4 I need an integration, fft, iir-filter,...!
74 * 5.5 Can I do heavy-duty data processing with gnuplot? or What is
75 beyond gnuplot?
76 * 5.6 Mouse in my interactive terminal does not work
77 * 5.7 How to use hotkeys in my interactive terminals
78 * 5.8 I have ported gnuplot to another system, or patched it. What
79 do I do?
80 * 5.9 I want to help in developing the next version of gnuplot.
81 What can I do?
82 * 5.10 Open questions for inclusion into the FAQ?
83 * 6 Making life easier
84 * 6.1 How do I plot two functions in non-overlapping regions?
85 * 6.2 How do I run my data through a filter before plotting?
86 * 6.3 How do I make it easier to use gnuplot with LATEX?
87 * 6.4 How do I save and restore my settings?
88 * 6.5 How do I plot lines (not grids) using splot?
89 * 6.6 How do I plot a function f(x,y) that is bounded by other
90 functions in the x-y plane?
91 * 6.7 How do I turn off <feature> in a plot?
92 * 6.8 How do I call gnuplot from my own programs?
93 * 6.9 What if I need h-bar (Planck's constant)?
94 * 6.10 What if I need the Solar mass symbol?
95 * 6.11 How do I produce blank output page?
96 * 7 Common problems
97 * 7.1 Help! None of my fonts work.
98 * 7.2 Gnuplot is not plotting any points under X11! How come?
99 * 7.3 Why does gnuplot ignore my very small numbers?
100 * 7.4 Gnuplot is not plotting on the screen when run from command
101 line via 'gnuplot filename.gp'
102 * 7.5 My formulas (like 1/3) are giving me nonsense results! What's
103 going on?
104 * 7.6 Set output 'filename' isn't outputting everything it should!
105 * 7.7 When using the LATEX-terminal, there is an error during the
106 LATEX-run!
107 * 7.8 I can't find the demos and example files at the URLs in the
108 documentation!
109 * 7.9 Calling gnuplot in a pipe or with a gnuplot-script doesn't
110 produce a plot!
111 * 8 Credits
112
113
114 0 Meta - Questions
115
116 0.1 Where do I get this document?
117
118 The newest version of this document is on the web at
119 http://www.gnuplot.info/faq/.
120
121 This document was/is posted sometimes to the newsgroups
122 ~comp.graphics.apps.gnuplot.
123
124 0.2 Where do I send comments about this document?
125
126 Send comments, suggestions etc via email to the developer mailing list
127 gnuplot-beta@lists.sourceforge.net. Please contribute your suggestions
128 with respect to the file faq.tex available from
129 http://cvs.sourceforge.net/viewcvs.py/gnuplot/faq/.
130
131
132 1 General Information
133
134 1.1 What is gnuplot?
135
136 gnuplot is a command-driven interactive function plotting program. It can
137 be used to plot functions and data points in both two- and
138 three-dimensional plots in many different formats. It is designed
139 primarily for the visual display of scientific data. gnuplot is
140 copyrighted, but freely distributable; you don't have to pay for it.
141
142 1.2 How did it come about and why is it called gnuplot?
143
144 The authors of gnuplot are: Thomas Williams, Colin Kelley, Russell Lang,
145 Dave Kotz, John Campbell, Gershon Elber, Alexander Woo and many others.
146
147 The following quote comes from Thomas Williams:
148
149 I was taking a differential equation class and Colin was taking
150 Electromagnetics, we both thought it'd be helpful to visualize the
151 mathematics behind them. We were both working as sys admin for an EE
152 VLSI lab, so we had the graphics terminals and the time to do some
153 coding. The posting was better received than we expected, and prompted
154 us to add some, albeit lame, support for file data.
155
156 Any reference to GNUplot is incorrect. The real name of the program is
157 "gnuplot". You see people use "Gnuplot" quite a bit because many of us
158 have an aversion to starting a sentence with a lower case letter, even
159 in the case of proper nouns and titles. gnuplot is not related to the
160 GNU project or the FSF in any but the most peripheral sense. Our
161 software was designed completely independently and the name "gnuplot"
162 was actually a compromise. I wanted to call it "llamaplot" and Colin
163 wanted to call it "nplot." We agreed that "newplot" was acceptable but,
164 we then discovered that there was an absolutely ghastly pascal program
165 of that name that the Computer Science Dept. occasionally used. I
166 decided that "gnuplot" would make a nice pun and after a fashion Colin
167 agreed.
168
169 1.3 What does gnuplot offer?
170
171 * Plotting two-dimensional functions and data points in many different
172 styles (points, lines, error bars)
173 * Plotting three-dimensional data points and surfaces in many different
174 styles (contour plot, mesh)
175 * Algebraic computation in integer, float and complex arithmetic
176 * User-defined functions and hot-keys
177 * Support for a large number of operating systems, graphics file formats
178 and output devices
179 * Extensive on-line help
180 * TEX-like text formatting for labels, titles, axes, data points
181 * Interactive command line editing and history (most platforms)
182
183 1.4 Is gnuplot suitable for scripting?
184
185 Yes. Gnuplot can read in files containing additional commands during an
186 interactive session, or it can be run in batch mode by piping a
187 pre-existing file or a stream of commands to stdin. Gnuplot is used as a
188 back-end graphics driver by such higher-level mathematical packages as
189 Octave, and can easily be wrapped in a cgi script for use as a web-driven
190 plot generator.
191
192 1.5 Can I run gnuplot on my computer?
193
194 Gnuplot is available for a number of platforms. These are: Unix (X11 and
195 NeXTSTEP), Linux, VMS, OS/2, MS-DOS, Amiga, MS-Windows, OS-9/68k, Atari
196 ST, BeOS, and Macintosh.
197
198 Please notify the FAQ-maintainer of any further ports you might be aware
199 of.
200
201 You should be able to compile the gnuplot source more or less out of the
202 box on any reasonable standard (ANSI/ISO C, POSIX) environment.
203
204 1.6 Legalities
205
206 Gnuplot is freeware authored by a collection of volunteers, who cannot
207 make any legal statement about the compliance or non-compliance of gnuplot
208 or its uses. There is also no warranty whatsoever. Use at your own risk.
209
210 Citing from the README of a mathematical subroutine package by R. Freund:
211
212 For all intent and purpose, any description of what the codes are doing
213 should be construed as being a note of what we thought the codes did on
214 our machine on a particular Tuesday of last year. If you're really
215 lucky, they might do the same for you someday. Then again, do you really
216 feel *that* lucky?
217
218 1.7 Does gnuplot have anything to do with the FSF and the GNU project?
219
220 Gnuplot is neither written nor maintained by the FSF. It is not covered by
221 the General Public License, either. It used to be distributed by the FSF,
222 however, due to licensing issues it is no longer.
223
224 Gnuplot is freeware in the sense that you don't have to pay for it.
225 However it is not freeware in the sense that you would be allowed to
226 distribute a modified version of your gnuplot freely. Please read and
227 accept the Copyright file in your distribution.
228
229 1.8 Where do I get further information?
230
231 See the main gnuplot web page http://www.gnuplot.info and references
232 therein, mainly gnuplot links http://gnuplot.sourceforge.net/links.html.
233
234 Some documentation and tutorials are available in other languages than
235 English. See http://gnuplot.sourceforge.net/help.html, section "Localized
236 learning pages about gnuplot", for the most up-to-date list.
237
238
239 2 Setting it up
240
241 2.1 What is the current version of gnuplot?
242
243 The current released version of gnuplot is 4.2.
244
245 2.2 Where can I get gnuplot?
246
247 The best place is definitely http://www.gnuplot.info. From there you find
248 various pointers to other sites.
249
250 The source distribution ("gnuplot-4.2.0.tar.gz" or a similar name) is
251 available from the official distribution site and its mirrors.
252
253 The main server is ftp.gnuplot.info in /pub/gnuplot/. This server is
254 mirrored by several others, among those are
255 * mirror.aarnet.edu.au in /pub/gnuplot/
256 * ftp.dartmouth.edu in /pub/gnuplot/
257 * ftp.irisa.fr in /pub/gnuplot/
258 * ftp.gnuplot.vt.edu in /pub/gnuplot/
259
260 As of June 1999, the gnuplot distribution is also mirrored at the
261 Comprehensive TeX Archive Network (CTAN) in the graphics/gnuplot
262 directory. See
263 * http://www.ctan.org/.
264
265 The following platform-specific sites below still exist, but may or may
266 not still hold gnuplot executables.
267
268 * Source and binary distributions for the Amiga are available on Aminet
269 ftp.wustl.edu in aminet/ and its mirrors, for example ftp.uni-kl.de,
270 oes.orst.edu or ftp.luth.se.
271
272 * MS-DOS and MS-Windows binaries are available from the above servers
273 and are called for example gp37dos.zip, gp37dj.zip, gp37w16.zip,
274 gp37mgw.zip, gnuplot3.7cyg.zip. OS/2 binaries are called gp37os2.zip.
275
276 * The NeXTSTEP front end can be found at next-ftp.peak.org in
277 /pub/next/binaries/plotting/Gnuplot1.2_bin.tar.Z.
278
279 * A version for OS-9/68K can be found at cabrales.cs.wisc.edu in
280 /pub/OSK/GRAPHICS/gnuplot32x.tar.Z; it includes both an X-Window
281 Systems and a non - X-Window Systems version.
282
283 * Versions for the Atari ST and TT, which include some GEM windowing
284 support, are available from ftp.uni-kl.de in /pub/atari/graphics/, as
285 gplt35st.zip and gplt35tt.zip. They work best under MiNT.
286
287 * Executable files, plus documentation in Japanese, exist for the X680x0
288 on ftp.csis.oita-u.ac.jp in /pub/x68k/fj.binaries.x68000/vol2.
289
290 2.3 Where can I get current development version of gnuplot?
291
292 The development version of gnuplot is availble as a cvs source tree online
293 for direct browsing from http://www.sourceforge.net/projects/gnuplot/,
294 section "CVS". You can download all current sources according to the
295 documentation therein; for example by a sequence of commands like
296
297 cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/gnuplot login
298 cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/gnuplot co -P gnuplot
299
300 or (in bash)
301
302 export CVSROOT=:pserver:anonymous@cvs.sourceforge.net:/cvsroot/gnuplot
303 cvs login
304 cvs -z3 checkout gnuplot
305
306 Further, before the ./configure command of gnuplot compilation phase, you
307 have to execute ./prepare to create the up-to-date configure files.
308
309 There are no official preliminary binary releases of gnuplot: you have to
310 compile it yourself. However, you may find unofficial binary releases for
311 some platforms, like OS/2, Windows or Macintosh.
312
313 Important note: questions related to the development version should go to
314 gnuplot-beta@lists.sourceforge.net.
315
316 2.4 How do I get gnuplot to compile on my system?
317
318 As you would any other installation. Read the files README.1ST and README.
319
320 * For Unix, use ./configure (or ./configure -prefix=$HOME/usr for an
321 installation for a single user), make and finally make install or make
322 install-strip, the latter for smaller executables without debugging
323 information. If you want to make a RPM package, then replace the
324 latest step by checkinstall or checkinstall make install-strip,
325 supposing the package checkinstall on your machine.
326 * For DOS, if you are using bash and DJGPP, you can just run
327 djconfig.sh.
328 * For other platforms, copy the relevant makefile (e.g. makefile.os2 for
329 OS/2, or makefile.mgw or makefile.cyg for Windows) from config/ to
330 src/, optionally update options in the makefile's header, then change
331 directory to src and run make.
332
333 2.5 What documentation is there, and how do I get it?
334
335 The documentation is included in the source distribution. Look at the docs
336 subdirectory, where you'll find
337
338 * a Unix man page, which says how to start gnuplot
339 * a help file, which also can be printed as a manual
340 * a tutorial on using gnuplot with LATEX
341 * a quick reference summary sheet for TEX only
342
343 The documentation is built during installation if you have LATEX installed
344 on your system, look in the directories docs and tutorial. make pdf in the
345 docs subdirectory will make a gnuplot.pdf hypertext file ready for
346 browsing or printing.
347
348 Online gnuplot documentation is available at
349 http://gnuplot.sourceforge.net/documentation.html.
350
351 (Obsolete?) PostScript copies of the documentation can be ftp'd from
352 ftp.gnuplot.info in /pub/gnuplot, as manual.ps.Z and tutorial.ps.Z.
353 Documentation about gnuplot is available at the gnuplot distribution sites
354 in the files gpdoc.zip and gpdoc2.zip.
355
356 2.6 Worked examples
357
358 There is a directory of worked examples in the the source distribution.
359 These examples, and the resulting plots, may also be found at
360 http://gnuplot.sourceforge.net/demo/.
361
362 2.7 How do I modify gnuplot, and apply 'patches'?
363
364 For this, you will need to recompile gnuplot.
365
366 Modifications people make are either done by replacing files, such as
367 terminal drivers, or by 'patching'. If a file is a replacement, it will
368 probably tell you in its README or in the lines at the beginning.
369
370 To patch a file, you need the patch utility, and possibly also automake
371 and autoconf. On many UNIX systems these will already be installed; If
372 they aren't, you can find them wherever GNU software is archived. Typical
373 command for applying a patch is patch -p0 <newfunctionality.diff.
374
375 There is repository of contributed patches in the "Patches" section on
376 gnuplot's sourceforge site http://www.sourceforge.net/projects/gnuplot/.
377
378
379 3 Working with it.
380
381 3.1 How do I get help?
382
383 Read this document.
384
385 Give the help command at the initial prompt. After that, keep looking
386 through the keywords. Good starting points are plot and set.
387
388 Read the manual, if you have it.
389
390 Look through the demo subdirectory; it should give you some ideas.
391
392 Ask your colleagues, the system administrator or the person who set up
393 gnuplot.
394
395 If all these fail, please upgrade to the newest version of gnuplot or urge
396 your system-administrator to do so. Then post a question
397 to ~comp.graphics.apps.gnuplot or send mail to the gatewayed mailing list
398 gnuplot-info@lists.sourceforge.net. Do not forget to cite the version
399 number and the operating system. If you want to subscribe to the mailing
400 list, send a mail to majordomo@lists.sourceforge.net with the body of the
401 message being subscribe info-gnuplot. Please don't do this if you can get
402 ~comp.graphics.apps.gnuplot directly. If you post a question there, it is
403 considered good form to solicit e-mail replies and post a summary.
404
405 3.2 How do I print out my graphs?
406
407 The kind of output produced is determined by the set terminal command; for
408 example, set terminal postscript will produce the graph in PostScript
409 format. Output can be redirected using the set output command.
410
411 As an example, the following prints out a graph of sin(x) on a Unix
412 machine running the X-Window System.
413
414 gnuplot> plot [-6:6] sin(x)
415 gnuplot> set terminal postscript
416 Terminal type set to 'postscript'
417 Options are 'landscape monochrome "Courier" 14'
418 gnuplot> set output "sin.ps"
419 gnuplot> replot
420 gnuplot> set output # set output back to default
421 gnuplot> set terminal x11 # ditto for terminal type
422 gnuplot> ! lp -ops sin.ps # print PS File (site dependent)
423 request id is lprint-3433 (standard input)
424 lp: printed file sin.ps on fg20.rz.uni-karlsruhe.de (5068 Byte)
425 !
426 gnuplot>
427
428 Using the platform-independent way of restoring terminal by set term
429 push/pop commands, do it by
430
431 gnuplot> set terminal postscript eps color lw 15 "Helvetica" 20
432 gnuplot> set out 'a.eps'
433 gnuplot> replot
434 gnuplot> set term pop
435
436 The command set term pop without a previous corresponding set term push
437 switches the terminal back to the startup terminal, e.g. x11, pm or win.
438
439 In Microschrott Windows you click in the upper left corner of the graph
440 window and print directly from there.
441
442 3.3 How do I include my graphs in <word processor>?
443
444 Basically, you save your plot to a file in a format your word processor
445 can understand (using set term and set output, see above), and then you
446 read in the plot from your word processor. Vector formats (PostScript,
447 emf, svg, pdf, TEX, LATEX, etc) should be preferred, as you can scale your
448 graph later to the right size.
449
450 Details depend on which word processor you use; use set term to get a list
451 of available file formats.
452
453 Many word processors can use Encapsulated PostScript for graphs. This can
454 be generated by the set terminal postscript eps [color] command. Note that
455 it is a good idea to check and correct the bounding box of the graphs in
456 the eps files (manually or by the fixbb script from gnuplot webpage), as
457 you have to correct this box for any eps figure produced by whichever
458 program. Some (most?) word processors do not preview the actual image in
459 the eps file, and you have to add the preview image yourself. You can use
460 the GSView viewer for this (available for OS/2, Windows and X11), or some
461 Unix ps tool. Note that the preview image increases size of the eps file;
462 the smallest increase you may get by choosing Tiff 6 Packbits.
463
464 Some office Windows applications, also OpenOffice.org, can handle vector
465 images produces by the emf terminal. OpenOffice.org can also read
466 AutoCAD's dxf format, as well as SVG thanks to SVG Import Filter
467 http://www.ipd.uni-karlsruhe.de/ hauma/svg-import/.
468
469 With TEX, it depends on what you use to print your dvi files. If you use
470 dvips or dvi2ps, you can use Encapsulated PostScript. For emTeX (popular
471 for OS/2 and MS-DOS), you can use emTeX, otherwise use the LATEX terminal
472 type, which generates a picture environment. You can also use epslatex to
473 separate the graphics and text parts. Other possibilities include pslatex
474 or pstex terminals, and metafont or metapost terminals.
475
476 With TEX processed by pdftex or pdflatex, you can use png, jpeg and pdf
477 terminal types. You can also use the postscript eps terminal and convert
478 the eps file externally to pdf by epstopdf. Another choice is the epslatex
479 terminal, after converting the eps part to pdf as above (the TEX part can
480 remain unchanged).
481
482 Most word processors can import bitmap images (png, pbm, etc). The
483 disadvantage of this approach is that the resolution of your plot is
484 limited by the size of the plot at the time it is generated by gnuplot,
485 which is generally a much lower resolution than the document will
486 eventually be printed in.
487
488 Under IBM OS/2, MacOS and Micro$oft Windows you can use the clipboard to
489 copy your graph and paste it into your favourite word processor.
490
491 The mif terminal type produces output for FrameMaker.
492
493 3.4 How do I edit or post-process a gnuplot graph?
494
495 This depends on the terminal type you use.
496
497 * X11 toolkits: You can use the terminal type fig and use the xfig
498 drawing program to edit the plot afterwards. You can obtain the xfig
499 program from its web site http://www.xfig.org. More information about
500 the text-format used for fig can be found in the fig-package.
501
502 You may use the tgif terminal, which creates output suitable for
503 reading within tgif (http://bourbon.cs.umd.edu:8001/tgif/), an
504 interactive 2-D drawing tool under X11.
505
506 * You may use the svg terminal (scalable vector graphics), which can be
507 further edited by a svg editor, e.g. Inkscape
508 (http://www.inkscape.org), Sodipodi (http://sodipodi.sourceforge.net),
509 Sketch (http://sketch.sourceforge.net) or Dia
510 (http://www.lysator.liu.se/ alla/dia), or loaded into OpenOffice.org
511 with an on-fly conversion into OO.o Draw primitives.
512
513 * PostScript or PDF output can be edited directly by tools such as Adobe
514 Illustrator or Acrobat, or can be converted to a variety of other
515 editable vector formats by the pstoedit package. Pstoedit is available
516 at http://www.pstoedit.net.
517
518 * The mif terminal type produces an editable FrameMaker document.
519
520 * The DXF format is the AutoCAD's format, editable by several other
521 applications.
522
523 * Bitmapped graphics (e.g. png, jpeg, pbm) can be edited using tools
524 such as ImageMagick or Gimp. In general, you should use a vector
525 graphics program to post-process vector graphic formats, and a
526 pixel-based editing program to post-process pixel graphics.
527
528 3.5 How do I change symbol size, line thickness and the like?
529
530 Gnuplot offers a variety of commands to set line and point properties,
531 including color, thickness, point shape, etc. The command test will
532 display a test page for the currently selected terminal type showing the
533 available pre-defined combinations of color, size, shape, etc. The set
534 style command can be used to define additional combinations.
535
536 3.6 How do I generate plots in GIF format?
537
538 GIF support is provided by an external library, libgd
539 (http://www.libgd.org). Old versions of gd (versions 1.2 to 1.4) produce
540 only GIF output. Versions 1.6 to 2.0.27 did not support GIF output because
541 of patent concerns. However versions 1.6 and newer support PNG outputs,
542 and 1.7 and newer support JPEG outputs. Version 2.0.28 of the Boutell gd
543 library restored GIF functionality, and 2.0.29 added support for GIF
544 animation. If your installation of gnuplot is linked to the gd library,
545 you will get support for whatever formats (GIF, PNG, JPEG) are in that
546 version of gd.
547
548 In any case, it is easy to convert from one format to another. To convert
549 a PNG output into GIF, you can either use the command line (e.g. convert
550 f.png f.gif or nconvert -out gif f.png) or any GUI program. Another
551 possibility is to output the image as (encapsulated) postscript and
552 convert (export) it into GIF or PNG by ghostscript, e.g. convert -density
553 150 f.eps f.gif or by any ghostscript-based GUI like gsview, gv or
554 kghostview.
555
556 3.7 Can I animate my graphs?
557
558 First have a look at animate.dem in the demo directory of gnuplot.
559 Basically, animated graphs are a sequence of plots in a suitable format.
560
561 If your installation of gnuplot is linked with gd 2.0.29 or newer (see
562 previous entry), the gif terminal can generate directly an animated GIF.
563
564 Otherwise, have a look at the tool whirlgif 3.04, available at
565 http://www.danbbs.dk/ dino/whirlgif. It reads run-length encoded GIF files
566 and packs them into a minimal animation. On the web-pages you will find a
567 manual and an example.
568
569 You can also write a small script to get gnuplot to output a family of GIF
570 files, then have it execute some animator such as gifsicle:
571 http://www.lcdf.org/ eddietwo/gifsicle or gifmerge
572 http://the-labs.com/GIFMerge.
573
574 mpeg_encode will encode a sequence of images into an mpeg format movie.
575
576 3.8 How do I plot implicit defined graphs?
577
578 Implicit graphs or curves cannot be plotted directly in gnuplot. However
579 there is a workaround.
580
581 gnuplot> # An example. Place your definition in the following line:
582 gnuplot> f(x,y) = y - x**2 / tan(y)
583 gnuplot> set contour base
584 gnuplot> set cntrparam levels discrete 0.0
585 gnuplot> unset surface
586 gnuplot> set table 'curve.dat'
587 gnuplot> splot f(x,y)
588 gnuplot> unset table
589 gnuplot> plot 'curve.dat' w l
590
591 The trick is to draw the single contour line z=0 of the surface z=f(x,y),
592 and store the resulting contour curve to a gnuplot datafile.
593
594 3.9 How to fill an area between two curves
595
596 A plot with filled area between two given curves requires a parametric
597 plot with filledcurves closed. The example below demonstrates this for two
598 curves f(x) and g(x) with a tricky "folded" parameter t:
599
600 set parametric
601 f(x)=cos(x)
602 g(x)=sin(x)
603 xmax=pi/4
604 set xrange [0:xmax]
605 set trange [0:2*xmax]
606 path(t) = ( t<= xmax ? f(t) : g(2*xmax-t) )
607 fold(t) = (t <=xmax ? t : 2*xmax - t)
608 plot fold(t),path(t) with filledcurves closed
609
610 Note that the above code fills area between the two curves, not area
611 satisfying inequality g(x)<f(x). If you want the latter, you should use
612 the ternary operator in path(t) to return an undefined value (0/0) if the
613 inequality is not satisfied.
614
615 See the documentation for help parametric, help filledcurves, and help
616 ternary.
617
618 3.10 Pm3d splot from a datafile does not draw anything
619
620 You do set pm3d; splot 'a.dat' and no plot but colorbox appears.
621 Obviously, there is no blank line in between two subsequent scans
622 (isolines) in the data file. Add blank lines! If you are curious what this
623 means, then don't hesitate to look to files like demo/glass.dat or
624 demo/triangle.dat in the gnuplot demo directory.
625
626 You can find useful the following awk script (call it e.g. addblanks.awk)
627 which adds blank lines to a data file whenever number in the first column
628 changes:
629
630 /^[[:blank:]]*#/ {next} # ignore comments (lines starting with #)
631 NF < 3 {next} # ignore lines which don't have at least 3 columns
632 $1 != prev {printf "\n"; prev=$1} # print blank line
633 {print} # print the line
634
635 Then, either preprocess your data file by command awk -f addblanks.awk
636 <a.dat or plot the datafile under a unixish platform by gnuplot> splot
637 "<awk -f addblanks.awk a.dat".
638
639 3.11 Drawing a (color) map, i.e. 2D projection of 3D data
640
641 Use set view map; unset surface or set pm3d map rather than set view
642 180,0. The latter facilitates drawing matrices or data files as maps, even
643 without the necessity for matrix-like data organization (gridding). It is
644 possible to decrease the output postscript file size by postprocessing it
645 by pm3dCompress.awk or pm3dConvertToImage.awk.
646
647 Note there is a new plotting style with image for plotting 2D color images
648 with support for almost arbitrary text or binary files in "Patches"
649 section on gnuplot's sourceforge site
650 http://www.sourceforge.net/projects/gnuplot/.
651
652 3.12 How to overlay dots/points scatter plot onto a pm3d map/surface
653
654 Use the explicit (see also implicit) switch of the pm3d style:
655
656 gnuplot> set pm3d explicit
657 gnuplot> splot x with pm3d, x*y with points
658
659 3.13 How to draw black contour plot, and contours with labels
660
661 Well, it is very simple even though it is hard to discover: unset clabel.
662
663 set contour both; set cntr levels 100
664 unset clabel
665 unset surface
666 splot x*y with line lt -1
667 pause -1
668 splot x*y with line palette
669
670 Another solution requires to write contours into a temporary file using
671 the table terminal:
672
673 set contour base; set cntrparam levels 15; unset surface; set view map
674 splot x*x+y*y; pause -1
675 set table 'contour.dat'
676 replot
677 unset table
678
679 Now, for drawing it in 2D, do
680
681 reset
682 plot 'contour.dat' with line -1
683
684 and for contours in 3D do
685
686 reset
687 # Change single blank lines to double blank lines
688 !awk "NF<2{printf\"\n\"}{print}" <contour.dat >contour1.dat
689 splot 'contour1.dat' with line -1
690
691 See also the following question "How to overlay contour plot over pm3d
692 map/surface".
693
694 Labelling contours by their z-value can be achieved by a suitable script
695 generating automatically the appropriate set label commands; you can find
696 one at gnuplot scripts page
697 http://gnuplot.sourceforge.net/scripts/index.html#tricks-here.
698
699 3.14 How to overlay contour plot over pm3d map/surface
700
701 This requires you to write contours into a temporary file using the table
702 terminal, and then use this file in the final drawing without set
703 contours. The following example demonstrates this for a map; for surface,
704 remove set pm3d map and put set ticslevel 0.
705
706 # Write contours of function x*x-y*y to a (temporary) file
707 set contour base; set cntrparam level 20
708 unset surface
709 set table 'contour.dat'
710 splot x*x-y*y
711 unset table
712
713 # Change single blank lines to double blank lines
714 !awk "NF<2{printf\"\n\"}{print}" <contour.dat >contour1.dat
715
716 # Draw the plot
717 reset
718 set palette gray
719 set palette gamma 2.5
720 set pm3d map
721 set pm3d explicit
722 splot x*x+y*y with pm3d, 'contour1.dat' with line lt -1
723 !rm contour.dat contour1.dat
724
725 The last command deletes the two temporary files.
726
727 3.15 Color facets with pm3d
728
729 It is possible to draw colors facets of a 3D objects, organized in such a
730 file:
731
732 # triangle 1
733 x0 y0 z0 <c0>
734 x1 y1 z1 <c1>
735
736 x2 y2 z2 <c2>
737 x2 y2 z2 <c2>
738
739
740 # triangle 2
741 x y z
742 ...
743
744 Notice the positioning single and double blank line. <c> is an optional
745 color.
746
747 Then plot it by (either of splot's):
748
749 set pm3d
750 set style data pm3d
751 splot 'facets.dat'
752 splot 'facets_with_color.dat' using 1:2:3:4
753
754 Note that you avoid surface lines by set style data pm3d or splot ... with
755 pm3d.
756
757 In the above example, pm3d displays triangles as independent surfaces.
758 They are plotted one surface after another, as found in the data file.
759 Parts overlapping in 2D projection are overdrawn.
760
761 Gnuplot is not 3D modeling program. Its hidden routines apply for points
762 and lines, but not for faces. Without handling the data as a collection of
763 faces, there would be no surface anything could be hidden behind. The
764 'hidden3d' algorithm works by using the input data in two ways: first, to
765 set up a collection of triangles (made from a mesh of quadrangles) that
766 form the surface, second as a collection of edges. It then goes through
767 all those edges, checking what parts of them are not hidden behind any
768 faces, and draws those.
769
770 Consequently, gnuplot won't draw your surface or 3D object as a virtual
771 reality. It works OK for set pm3d map but for true 3D you would be
772 probably more happy writing a convertor of your facets into a VRML file.
773
774 3.16 Palette for printing my color map on color as well as black&white printer?
775
776 I think it is this one, for example: set palette rgbformulae -25,-24,-32.
777 Can somebody prove this?
778
779
780 4 Wanted features
781
782 4.1 What's new in gnuplot 3.7, 4.0, 4.2 etc?
783
784 Too many things to be named here. Please refer to the NEWS file in the
785 source distribution, or the "New features" section in the gnuplot
786 documentation.
787
788 4.2 Does gnuplot support a driver for <graphics format>?
789
790 To see a list of the available graphic drivers for your installation of
791 gnuplot, type set term.
792
793 Some graphics drivers are included in the normal distribution, but are
794 uncommented by default. If you want to use them, you'll have to change
795 file gnuplot/src/term.h, and recompile.
796
797 4.3 Does gnuplot have hidden line removal?
798
799 Yes.
800
801 4.4 Does gnuplot support bar-charts/histograms/boxes?
802
803 Various clustered and stacked histogram styles are supported in gnuplot
804 version 4.2 as separate style types.
805
806 In older gnuplot versions you can use the style with boxes for bar charts.
807 To get filled boxes, use set style fill. Bernhard Reiter wrote an AWK
808 script to post-process fig-terminal output. This may be useful with older
809 versions of gnuplot. Please have a look at
810 http://www.usf.uni-osnabrueck.de/ breiter/tools/gnuplot/barchart.en.html.
811
812 4.5 Does gnuplot support pie charts?
813
814 It's not possible in gnuplot, but have a look at
815 http://www.usf.uni-osnabrueck.de/ breiter/tools/piechart/piecharts.en.html
816
817 4.6 Does gnuplot quarterly time charts?
818
819 It's not possible in gnuplot, but have a look at
820 http://ricardo.ecn.wfu.edu/ cottrell/qplot. The corresponding file
821 qplot.zip can be obtained from the contrib directory on any gnuplot
822 server.
823
824 4.7 Can I put multiple pages on one page?
825
826 Yes. set multiplot.
827
828 If you use the postscript terminal and plot one graph per page you can use
829 the program mpage (http://www.mesa.nl/pub/mpage) to print multiple logical
830 pages per physical page. A similar program is the psnup program in the
831 psutils package. This package is available at any CTAN mirror.
832
833 4.8 Does gnuplot support multiple y-axes on a single plot?
834
835 Yes. You can have 2 x- and 2 y-axes per plot. The additional axes are
836 called x2 and y2. See help plot.
837
838 4.9 Can I put both commands and data into a single file?
839
840 This is possible by the new plot "-" possibility. The plot "-" command
841 allows to read the data to be plot from standard input or the current
842 batch job.
843
844 gnuplot> plot "-"
845 1 1
846 2 4
847 3 9
848 e
849
850 4.10 Can I put Greek letters and super/subscripts into my labels?
851
852 The enhanced option in some terminals (currently postscript, Presentation
853 Manager, png, pdf, and x11) lets you use sub- and superscripts. It also
854 allows to use Greek letters and symbols via symbol fonts, to the extent
855 that these are supported by the underlying font libraries on your system.
856 Versions through 2.0.15 of libgd (needed for png and jpeg) must be patched
857 in order to handle symbol fonts.
858
859 You might try using the LATEX terminal type and putting text like
860 "\\alpha_{3}" or '\alpha_{3}' . If you include your gnuplot-graphs into a
861 LATEX document you can use the LATEX-package psfrag to typeset any
862 characters into your graphs.
863
864 One more possibility is to use the MetaPost terminal. It supports TEX
865 syntax and is converted onto encapsulated PostScript by mpost.
866
867 4.11 How do I include accented characters
868
869 To obtain accented characters like u: or n in your labels you should use
870 8bit character codes together with the appropriate encoding option. See
871 the following example:
872
873 gnuplot> set encoding iso_8859_1
874 gnuplot> set title "M\374nchner Bierverbrauch \374ber die Jahre"
875 gnuplot> plot "bier.dat" u 1:2
876
877 Consequently, you can type labels in Czech, French, Hungarian, Russian...
878 by means of an appropriate set encoding. However, you cannot mix two
879 encodings in one file (e.g. accents for west and east latin encodings).
880
881 A more general solution is to use UTF-8 encoded fonts, and type the UTF-8
882 characters directly into gnuplot. This works for many terminal types but
883 not, unfortunately, PostScript.
884
885 4.12 Can I do 1:1 scaling of axes?
886
887 Use set size square.
888
889 4.13 Can I put different text sizes into my plots?
890
891 Some terminals can, others can't. Some allow you to choose a font size for
892 the entire plot. Terminals supporting the "enhanced text" mode (like
893 postscript, pm, x11, png, pdf) allow you to change fonts and text sizes
894 within a plot. Look at the help for these terminals.
895
896 4.14 How do I skip data points?
897
898 By specifying ? as a data value, as in
899
900 1 2
901 2 3
902 3 ?
903 4 5
904
905 See also set missing. See also set datafile commentschars for specifying
906 comment characters in data files.
907
908 4.15 How do I plot every nth point?
909
910 This can be specified with various options for the command plot, for
911 example plot 'a.dat' every 2.
912
913 4.16 How do I plot a vertical line?
914
915 Depending on context, the main methods are:
916 * set arrow .... .... nohead where you have to compute explicitly the
917 start and the end of the arrow.
918 * generate (inlined) datapoints and plot them
919 * switch to parametric mode
920
921 4.17 How do I plot data files
922
923 Easily: by a command plot 'a.dat'. In 3D, use splot 'a.dat' - but don't
924 forget to put a blank line in between two subsequent scans (isolines),
925 otherwise you will get an error that the data is not gridded; see also
926 question 3.10. If your data are not gridded, then use set dgrid3d {many
927 options}.
928
929 4.18 How do I replot multiplot drawing
930
931 You cannot directly: gnuplot supports replot command, not remultiplot. You
932 have to write the complete sequence of commands since set multiplot till
933 unset multiplot into a script file. Then you can load the script into
934 gnuplot as many times as you need for replotting the drawing to different
935 terminals or output files.
936
937
938 5 Miscellaneous
939
940 5.1 I've found a bug, what do I do?
941
942 First, try to see whether it actually is a bug, or whether it is a feature
943 which may be turned off by some obscure set-command.
944
945 Next, see whether you have an old version of gnuplot; if you do, chances
946 are the bug has been fixed in a newer release.
947
948 Fixes for bugs reported since the release of the current version are held
949 in the patches directory at gnuplot distribution sites. Before submitting
950 a bug report, please check whether the bug in question has already been
951 fixed.
952
953 If, after checking these things, you still are convinced that there is a
954 bug, proceed as follows. If you have a fairly general sort of bug report,
955 posting to ~comp.graphics.apps.gnuplot is probably the way to go. If you
956 have investigated a problem in detail, especially if you have a context or
957 unified diff that fixes the problem, please e-email a report to
958 gnuplot-bug@lists.sourceforge.net.
959
960 The bug-gnuplot list is for reporting and collecting bug fixes, the
961 ~comp.graphics.apps.gnuplot newsgroup will be more help for finding work
962 arounds or actually solving gnuplot related problems. If you do send in a
963 bug report, be sure and include the version of gnuplot (including
964 patchlevel) as shown by the command show version long, terminal driver,
965 operating system, an exact description of the bug and input which can
966 reproduce the bug. Failure to indicate these details can render a solution
967 to your problem almost impossible. Also, any context diffs should be
968 referenced against the latest official version of gnuplot if at all
969 possible.
970
971 5.2 Can I use gnuplot routines for my own programs?
972
973 On systems supporting pipes, you can pipe commands to gnuplot from other
974 programs. Many applications with gnuplot as the graphics engine, like
975 Octave (http://www.octave.org), uses this method. This also works from a
976 cgi script to drive gnuplot from a forms-based web page.
977
978 John Campbell (jdc@nauvax.ucc.nau.edu) modified a much earlier version of
979 gnuplot (3.5) to be a library of C subroutines callable from a C program.
980 Gnuplot itself has changed radically since then, and we are not aware of
981 any plans to create a similar library based on the current version.
982
983 5.3 What extensions have people made to gnuplot? Where can I get them?
984
985 Many extensions or patches are available on the "Patches" page of the
986 gnuplot development site
987 http://sourceforge.net/tracker/?group_id=2055&atid=302055. The current
988 development version will generally include some of these being debugged
989 for inclusion in a later official release of gnuplot.
990
991 Older extensions, which may or may not work with the current version, are
992 available from ftp.ucc.ie in /pub/gnuplot/contrib/.
993
994 Some extensions available:
995 * date-errorbar: allows dates in the hi/lo fields for errorbars.
996 * perltk: A perl/tk canvas widget.
997 * polyg.patch: Implements a polygon plotting style.
998 * xgfe: graphical front end using the Qt widgets available at
999 http://www.tug.org/tex-archive/graphics/gnuplot/contrib/.
1000 * Gnuplot.py: A python package to create graphs from within python. More
1001 information at http://gnuplot-py.sourceforge.net.
1002
1003 5.4 I need an integration, fft, iir-filter,...!
1004
1005 Gnuplot has been and is a plotting program, not a data processing or
1006 mathematical program suite. Therefore gnuplot can't do that. Look into the
1007 demo file "bivariat.dem" for a basic implementation of an integration.
1008
1009 For more sophisticated data-processing read the next section.
1010
1011 5.5 Can I do heavy-duty data processing with gnuplot? or What is beyond gnuplot?
1012
1013 gnuplot alone is not suited very well for this. One thing you might try is
1014 fudgit, an interactive multi-purpose fitting program written by Martin-D.
1015 Lacasse (isaac@frodo.physics.mcgill.ca). It can use gnuplot as its
1016 graphics back end and is available from ftp.physics.mcgill.ca in
1017 /pub/Fudgit/fudgit_2.33.tar.Z and from the main Linux server,
1018 tsx-11.mit.edu and its numerous mirrors around the world as
1019 /pub/linux/sources/usr.bin/fudgit-2.33.tar.z. Versions are available for
1020 AIX, Data General, HP-UX, IRIX 4, Linux, NeXT, Sun3, Sun4, Ultrix, OS/2
1021 and MS-DOS. The MS-DOS version is available on simtel20 mirrors (simtel20
1022 itself has closed down) in the "math" subdirectory as fudg_231.zip.
1023
1024 Carsten Grammes has written a fitting program which has been merged into
1025 gnuplot 3.7.
1026
1027 Michael Courtney has written a program called lsqrft, which uses the
1028 Levenberg-Marquardt - algorithm for fitting data to a function. It is
1029 available from hobbes.nmsu.edu in /pub/os2/apps/analysis/lsqrft15.zip;
1030 sources, which should compile on Unix, and executables for MS-DOS and OS/2
1031 are available. There is an interface to the OS/2 presentation manager.
1032
1033 You might also want to look at the applications developed by the Software
1034 Tools Group (STG) at the National Center for Supercomputing Applications.
1035 Ftp to ftp.ncsa.uiuc.edu and get the file README.BROCHURE for more
1036 information.
1037
1038 You can also try pgperl, an integration of the PGPLOT plotting package
1039 with Perl 5. Information can be found at
1040 http://www.ast.cam.ac.uk/AAO/local/www/kgb/pgperl, the source is available
1041 from ftp.ast.cam.ac.uk in /pub/kgb/pgperl/ or linux.nrao.edu in
1042 /pub/packages/pgperl/.
1043
1044 Another possibility is Octave. To quote from its README: Octave is a
1045 high-level language, primarily intended for numerical computations. Octave
1046 is licensed under GPL, and in principle, it is a free Matlab clone. It
1047 provides a convenient command line interface for solving linear and
1048 nonlinear problems numerically. The latest released version of Octave is
1049 always available from http://www.octave.org. By the way, octave uses
1050 gnuplot as its plotting engine, so you get a data-processing program on
1051 top of gnuplot.
1052
1053 Finally, there is scilab at http://www-rocq.inria.fr/scilab/ doing about
1054 the same as matlab. It is free but copyrighted software.
1055
1056 5.6 Mouse in my interactive terminal does not work
1057
1058 If your mouse is not working, try to hit 'm' in the interactive terminal
1059 to switch mousing on/off. See below for the list of supported interactive
1060 terminals.
1061
1062 If it still does not run, then either gnuplot has not been configured or
1063 compiled with mouse support, or you have not properly installed it, or
1064 running an older version of gnuplot (check your PATH).
1065
1066 If your gnuplot is running as the plotting engine of Octave under X11,
1067 then please put set mouse into your $HOME/.gnuplot (preferred than putting
1068 gset mouse into $HOME/.octaverc). This is needed only for gnuplot 4.0:
1069 according to its help x11_mouse, gnuplot 4.0 under x11 running through a
1070 pipe needs set mouse to be executed before launching the x11 plot window.
1071
1072 5.7 How to use hotkeys in my interactive terminals
1073
1074 There are several hotkeys available in interactive terminals. Currently
1075 the following interactive terminals support hotkeys and mousing: OS/2
1076 Presentation Manager, X11, Windows, WX, and GGI. Hit 'h' in the terminal
1077 to get list of hotkeys. See help new-features or the Features introduced
1078 in version 4.0 section in the docs for a brief guide over mousing and
1079 hotkeys. Further, you may read help mouse and help bind for more
1080 information.
1081
1082 5.8 I have ported gnuplot to another system, or patched it. What do I do?
1083
1084 If your patch is small, mail it to gnuplot-beta@lists.sourceforge.net,
1085 with a thorough description of what the patch is supposed to do, which
1086 version of gnuplot it is relative to, etc. Well, please do it always with
1087 respect to the current development version of gnuplot (see 'cvs' above).
1088
1089 Nowadays, the preferred way of submitting, commenting and upgrading
1090 patches are via 'Patches' section on
1091 http://www.sourceforge.net/projects/gnuplot/. You may want to send a note
1092 to gnuplot-beta@lists.sourceforge.net for more lively discussion.
1093
1094 5.9 I want to help in developing the next version of gnuplot. What can I do?
1095
1096 Join the gnuplot beta test mailing list by sending a mail containing the
1097 line subscribe gnuplot-beta in the body (not the subject) of the mail to
1098 Majordomo@lists.sourceforge.net.
1099
1100 Also check with http://sourceforge.net/projects/gnuplot about latest
1101 source for beta releases for development.
1102
1103 5.10 Open questions for inclusion into the FAQ?
1104
1105 Please submit your questions (along with the answer) to
1106 gnuplot-beta@lists.sourceforge.net.
1107
1108
1109 6 Making life easier
1110
1111 6.1 How do I plot two functions in non-overlapping regions?
1112
1113 Use a parametric plot. An example:
1114
1115 gnuplot> set parametric
1116 gnuplot> a=1
1117 gnuplot> b=3
1118 gnuplot> c=2
1119 gnuplot> d=4
1120 gnuplot> x1(t) = a+(b-a)*t
1121 gnuplot> x2(t) = c+(d-c)*t
1122 gnuplot> f1(x) = sin(x)
1123 gnuplot> f2(x) = x**2/8
1124 gnuplot> plot [t=0:1] x1(t),f1(x1(t)) title "f1", x2(t), f2(x2(t)) title "f2"
1125
1126 You can also use gnuplot's ability to ignore mathematically undefined
1127 expressions: the expression 1/0 is silently ignored, thus a construction
1128 like
1129
1130 gnuplot> set xran [-10:10]
1131 gnuplot> plot (abs(x)>0.5?1/0: x**2)
1132
1133 plots a quadratic function only for |x| < 0.5.
1134
1135 6.2 How do I run my data through a filter before plotting?
1136
1137 If your system supports the popen() function, as Unix does, you should be
1138 able to run the output through another process, for example a short awk
1139 program, such as
1140
1141 gnuplot> plot "< awk ' { print $1, $3/$2 } ' file.in"
1142
1143 The plot command is very powerful and is able to do some arithmetic on
1144 datafiles. See help plot.
1145
1146 The above filtering works seamlessly under Unixes and OS/2. It can work
1147 under MS Windows as well, but that is for experienced users: (A) When
1148 gnuplot has been compiled by cygwin with the unixish way of ./configure;
1149 make with X11 terminal instead of the 'windows' terminal. You have to run
1150 this under an X-server. This procedure is out of knowledge for usual
1151 users, but powerful for others. (B) Compile gnuplot yourself by
1152 makefile.mgw or makefile.cyg and set PIPES=1 therein. The drawback is that
1153 each wgnuplot.exe will be accompanied by a boring shell box.
1154
1155 6.3 How do I make it easier to use gnuplot with LATEX?
1156
1157 There is a set of LATEX macros and shell scripts that are meant to make
1158 your life easier when using gnuplot with LATEX. This package can be found
1159 on ftp.dartmouth.edu in pub/gnuplot/latex.shar, by David Kotz. For
1160 example, the program "plotskel" can turn a gnuplot-output file plot.tex
1161 into a skeleton file skel.tex, that has the same size as the original plot
1162 but contains no graph. With the right macros, the skeleton can be used for
1163 preliminary LATEX passes, reserving the full graph for later passes,
1164 saving tremendous amounts of time.
1165
1166 6.4 How do I save and restore my settings?
1167
1168 Use the save and load commands for this; see help save and help load for
1169 details.
1170
1171 You can save the current terminal and restore it later without touching
1172 the filesystem by set term push and set term pop, respectively.
1173
1174 6.5 How do I plot lines (not grids) using splot?
1175
1176 If the data in a data file for splot is arranged in such a way that each
1177 one has the same number of data points (using blank lines as delimiters,
1178 as usual), splot will plot the data with a grid. If you want to plot just
1179 lines, use a different number of data entries (you can do this by doubling
1180 the last data point, for example). Don't forget to set parametric mode, of
1181 course.
1182
1183 6.6 How do I plot a function f(x,y) that is bounded by other functions in the
1184 x-y plane?
1185
1186 An example:
1187
1188 gnuplot> f(x,y) = x**2 + y **2
1189 gnuplot> x(u) = 3*u
1190 gnuplot> yu(x) = x**2
1191 gnuplot> yl(x) = -x**2
1192 gnuplot> set parametric
1193 gnuplot> set cont
1194 gnuplot> splot [0:1] [0:1] u,yl(x(u))+(yu(x(u)) - yl(x(u)))*v,\
1195 > f(x(u), (yu(x(u)) - yl(x(u)))*v)
1196
1197 6.7 How do I turn off <feature> in a plot?
1198
1199 Most gnuplot features are controlled by a corresponding set/unset command.
1200 If a feature is enabled by default, or by using set <feature>, then you
1201 should be able to turn it by using set no<feature>. However, the prefered
1202 syntax since version 4.0 is unset <feature>.
1203
1204 6.8 How do I call gnuplot from my own programs?
1205
1206 On unix-like systems, commands to gnuplot can be piped via stdin. Output
1207 from gnuplot's print command can be read via a named pipe. On M$ Windows
1208 platforms, due to the lacking standard input (stdin) in GUI programs, you
1209 need to use the helper program pgnuplot which should be included in your
1210 gnuplot for M$W distribution package. Reading gnuplot output may be
1211 impossible.
1212
1213 6.9 What if I need h-bar (Planck's constant)?
1214
1215 The most straightforward way is to use a UTF-8 font, and type in the
1216 $\hbar$ character (Unicode code point #x210F) directly.
1217
1218 This does not work in PostScript, however, so you must use approximations
1219 like @{/=56 -} {/=24 h} or {/=8 @{/Symbol=24 -} _{/=14 h}} In the latter,
1220 the "-" (a long one in /Symbol) is non-spacing and 24-pt. The 14-pt "h" is
1221 offset by an 8-pt space (which is the space preceding the "_") but
1222 smaller, since it's written as a subscript. But these don't look too much
1223 like the hbar we're used to, since the bar is horizontal instead of
1224 sloped. I don't see a way to get that. I tried using an accent (character
1225 264 in iso-latin-1 encoding), but I haven't found a way to scale and
1226 position the pieces correctly. One more possibility would be {/=14
1227 @^{/Symbol=10 -}{/=14 h}}.
1228
1229 The reduced Planck's constant can be set very easily by using the
1230 AMS-LaTeX PostScript fonts which are available from
1231 http://www.ams.org/tex/amsfonts.html (also included in many LaTeX
1232 distributions). Gnuplot (confer the help about fontpath) and the
1233 PostScript interpreter (usually Ghostscript) have to know where the file
1234 msbm10.pfb (or msbm10.pfa) resides. Use {/MSBM10 \175} to produce \hslash
1235 which is a "h" superimposed by a sloped bar. The standard \hbar
1236 (horizontal bar) has the octal code 176. Please note that h-bar exists
1237 only as an italic type.
1238
1239 6.10 What if I need the Solar mass symbol?
1240
1241 As with Planck's constant, the most straightforward way is to use a UTF-8
1242 font, and type in the $\odot$ character (Unicode code point #x2299)
1243 directly.
1244
1245 6.11 How do I produce blank output page?
1246
1247 Well, you probably don't want a blank page, but page with a just a title
1248 (overprinting title in another graph in multiplot page):
1249
1250 reset; unset xtics; unset ytics
1251 unset border; unset key
1252 set title 'Title on an empty page'
1253 plot [][0:1] 2
1254
1255
1256 7 Common problems
1257
1258 7.1 Help! None of my fonts work.
1259
1260 Gnuplot does not do font handling by itself; it must necessarily leave
1261 that to the individual device support libraries. Unfortunately, this means
1262 that different terminal types need different help in finding fonts. Here
1263 are some quick hints. For more detailed information please see the gnuplot
1264 documentation for the specific terminal type you are having problems with.
1265
1266 png/jpeg/gif
1267 These terminal types use the libgd support library, which searches
1268 for fonts in the directories given in the environmental variable
1269 GDFONTPATH. Once you get libgd fontpaths sorted out, you will
1270 probably want to set a default font for gnuplot. For example:
1271 setenv GNUPLOT_DEFAULT_GDFONT verdana
1272
1273 pdf
1274 The libpdf support library should have come with an associated
1275 font configuration file, usually installed as
1276 /usr/local/share/pdflib.upr. The environmental variable
1277 PDFLIBRESOURCE should point to this file.
1278
1279 post
1280 PostScript font names are not resolved until the document is
1281 printed. Gnuplot does not know what fonts are available to your
1282 printer, so it will accept any font name you give it. However, it
1283 is possible to bundle a font with the gnuplot output; please see
1284 the instructions given by gnuplot's internal command ``help set
1285 term post fontfile''.
1286
1287 svg
1288 Font handling is viewer-dependent.
1289
1290 x11
1291 The x11 terminal uses the normal x11 font server mechanism. The
1292 only tricky bit is that in order to use multi-byte fonts you must
1293 explicitly say so:
1294
1295 set term x11 font "mbfont:sazanami mincho,vera,20"
1296
1297 win
1298 Right-click in the control window, then select "Choose font" from
1299 the pull-down menu.
1300
1301 wxt
1302 On linux systems, the wxt terminal can find fonts indexed by the
1303 fontconfig utility.
1304
1305 7.2 Gnuplot is not plotting any points under X11! How come?
1306
1307 On VMS, you need to make several symbols:
1308
1309 $ gnuplot_x11 :== $disk:[directory]gnuplot_x11
1310 $ gnuplot :== $disk:[directory]gnuplot.exe
1311 $ def/job GNUPLOT$HELP disk:[directory]gnuplot.hlb
1312
1313 Then run gnuplot from your command line, and use set term x11.
1314
1315 If you run gnuplot on Unix systems, be sure that the newest gnuplot_x11 is
1316 the first in your search path. Command which gnuplot_x11 will help you.
1317
1318 7.3 Why does gnuplot ignore my very small numbers?
1319
1320 Gnuplot treats all numbers less than 1e-08 as zero, by default. Thus, if
1321 you are trying to plot a collection of very small numbers, they may be
1322 plotted as zero. Worse, if you're plotting on a log scale, they will be
1323 off scale. Or, if the whole set of numbers is "zero", your range may be
1324 considered empty:
1325
1326 gnuplot> plot 'test1'
1327 Warning: empty y range [4.047e-19:3e-11], adjusting to [-1:1]
1328 gnuplot> set yrange [4e-19:3e-11]
1329 gnuplot> plot 'test1'
1330 ^
1331 y range is less than `zero`
1332
1333 The solution is to change gnuplot's idea of "zero":
1334
1335 gnuplot> set zero 1e-20
1336
1337 For more information, type help set zero.
1338
1339 7.4 Gnuplot is not plotting on the screen when run from command line via
1340 'gnuplot filename.gp'
1341
1342 Obviously, it draws (unless there is an error in the script file), but the
1343 plot dissappears immediately when the script is completed.
1344
1345 Solution 1: Put a pause -1 after the plot command in the file, or at the
1346 file end.
1347
1348 Solution 2: Use command gnuplot filename.gp - (yes, dash is the last
1349 parameter) to stay in the interactive regime when the script completes.
1350
1351 Solution 3A: On an X-Window System system, you can also use the -persist
1352 option, the X11 window is then not closed. Close the X11 window by typing
1353 "q" when the focus is on it.
1354
1355 Solution 3B: On M$ Windows, you can also use either -persist or /noend.
1356
1357 Solution 4: For OS/2 PM terminal, use set term pm persist or set term pm
1358 server. For X11 terminal, use set term x11 persist.
1359
1360 7.5 My formulas (like 1/3) are giving me nonsense results! What's going on?
1361
1362 Gnuplot does integer, and not floating point, arithmetic on integer
1363 expressions. For example, the expression 1/3 evaluates to zero. If you
1364 want floating point expressions, supply trailing dots for your floating
1365 point numbers. Example:
1366
1367 gnuplot> print 1/3
1368 0
1369 gnuplot> print 1./3.
1370 0.333333
1371
1372 This way of evaluating integer expressions is shared by both C and
1373 Fortran.
1374
1375 7.6 Set output 'filename' isn't outputting everything it should!
1376
1377 You may need to flush the output with a closing set output.
1378
1379 7.7 When using the LATEX-terminal, there is an error during the LATEX-run!
1380
1381 The LATEX2$\epsilon$-core no longer includes the commands
1382 "$\backslash$Diamond" and "$\backslash$Box"; they are included in the
1383 latexsym package. Other symbols are taken from the asmsymb package. Both
1384 of these are part of the base distribution and thus part of any LaTeX
1385 implementation. Please remember to include these packages in your LaTeX
1386 document.
1387
1388 7.8 I can't find the demos and example files at the URLs in the documentation!
1389
1390 The examples have been removed from the NASA site mentioned in older
1391 documentation. You can find the version 4.0 examples at
1392 http://gnuplot.sourceforge.net/demo. Version 4.2 examples are at
1393 http://gnuplot.sourceforge.net/demo_4.2.
1394
1395 7.9 Calling gnuplot in a pipe or with a gnuplot-script doesn't produce a plot!
1396
1397 You can call gnuplot by using a short Perl-script like the following:
1398
1399 #!/usr/local/bin/perl -w
1400 open (GP, "|/usr/local/bin/gnuplot -persist") or die "no gnuplot";
1401 # force buffer to flush after each write
1402 use FileHandle;
1403 GP->autoflush(1);
1404 print GP,"set term x11;plot '/tmp/data.dat' with lines\n";
1405 close GP
1406
1407 Gnuplot closes its plot window on exit. The close GP command is executed,
1408 and the plot window is closed even before you have a chance to look at it.
1409
1410 There are three solutions to this: first, use the pause -1 command in
1411 gnuplot before closing the pipe. Second, close the pipe only if you are
1412 sure that you don't need gnuplot and its plot window anymore. Last, you
1413 can use the command line option -persist: this option leaves the X-Window
1414 System plot window open.
1415
1416 8 Credits
1417
1418 Gnuplot 3.7's main contributors are (in alphabetical order) Hans-Bernhard
1419 Broeker, John Campbell, Robert Cunningham, David Denholm, Gershon Elber,
1420 Roger Fearick, Carsten Grammes, Lucas Hart, Lars Hecking, Thomas Koenig,
1421 David Kotz, Ed Kubaitis, Russell Lang, Alexander Lehmann, Alexander Mai,
1422 Carsten Steger, Tom Tkacik, Jos Van der Woude, James R. Van Zandt, and
1423 Alex Woo. Additional substantial contributors to version 4.0 include Ethan
1424 Merritt, Petr Mikulik and Johannes Zellner.
1425
1426 This list was initially compiled by John Fletcher with contributions from
1427 Russell Lang, John Campbell, David Kotz, Rob Cunningham, Daniel Lewart and
1428 Alex Woo. Reworked by Thomas Koenig from a draft by Alex Woo, with
1429 corrections and additions from Alex Woo, John Campbell, Russell Lang,
1430 David Kotz and many corrections from Daniel Lewart. Again reworked for
1431 gnuplot 3.7 by Alexander Mai and Juergen v.Hagen with corrections by Lars
1432 Hecking, Hans-Bernhard Broecker and other people. Revised for gnuplot 4.0
1433 release by Petr Mikulik and Ethan Merritt. Revised for gnuplot 4.2 release
1434 by Petr Mikulik and Ethan Merritt.
1435