This document deals with gnuplot version 4.6 which is the latest official release as of March 2012.
Its version is $Revision: 1.51 $, dated $Date: 2014/01/09 03:52:32 $.
The newest version of this document is on the web at www.gnuplot.info/faq/.
Send comments, suggestions etc via email to the developer mailing list gnuplot-beta@lists.sourceforge.net. Please contribute your suggestions with respect to the file faq.tex available from gnuplot.cvs.sourceforge.net/viewvc/gnuplot/faq/.
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.
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.
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.
Gnuplot is in widespread use on many platforms, including MS Windows, linux, unix, and OSX. The current source code retains supports for older systems as well, including VMS, Ultrix, OS/2, MS-DOS, BeOS, and Macintosh. Versions since 4.0 have not been extensively tested on legacy platforms.
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.
Gnuplot is 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 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?
Gnuplot is neither written nor maintained by the FSF. At one time it was distributed by the FSF but this is no longer true. Gnuplot as a whole is not covered by the GNU General Public License (GPL).
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 modification and redistribution terms in the Copyright file.
See the main gnuplot web page www.gnuplot.info.
Some documentation and tutorials are available in other languages than English. See gnuplot.sourceforge.net/help.html, section "Localized learning pages about gnuplot", for the most up-to-date list.
The current released version of gnuplot is 4.6, released in March 2012. Incremental versions (patchlevel 1, 2, ...) are typically released every six months. The development version of gnuplot is currently labeled 4.7.
The best place to start is www.gnuplot.info. From there you find various pointers to other sites, including the project development site on SourceForge sourceforge.net/projects/gnuplot.
The source distribution ("gnuplot-4.6.0.tar.gz" or a similar name) is available from the official distribution site sourceforge.net/projects/gnuplot.
The development version of gnuplot is availble as a cvs source tree online for direct browsing from 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
or (in bash)
Hit <return> when asked for a password.
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 gnuplot-beta@lists.sourceforge.net.
As you would any other installation. Read the files README.1ST, README, and INSTALL.
Full documentation is included in the source distribution. Individual sections can be browsed from inside a gnuplot session by typing help keyword. Look in the docs and tutorial subdirectories, where you’ll find files to produce
Online gnuplot documentation is available at gnuplot.sourceforge.net/documentation.html.
There is a directory of worked examples in the the source distribution. These examples, and the resulting plots, may also be found at gnuplot.sourceforge.net/demo/.
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 the automake and autoconf tools. A 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 sourceforge.net/tracker/?group_id=2055&atid=302055.
Given that you have a compiled version of gnuplot, you can use the show command to display the list of compile options (a.k.a. compilation options, or build options) that were used to build your copy.
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 gnuplot-info@lists.sourceforge.net. Please note that, due to the overwhelming amount of spam it would otherwise receive, you have to subscribe before you can post to it. Subscription instructions are in the main gnuplot manual. Do not forget to cite the version number and the operating system. If you want to subscribe to the mailing list, visit the URL lists.sourceforge.net/lists/listinfo/gnuplot-info. But please don’t use the mailing list if you can read 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.
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.
Using the platform-independent way of restoring terminal by set term push/pop commands, do it by
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.
Using the windows terminal, you can print your graph by clicking on the printer icon on the terminals toolbar, or by issuing screendump on the command line.
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 (*.eps) for graphs. You can select eps output in gnuplot using the set terminal postscript eps 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.
Some Windows office applications, including OpenOffice.org, can handle vector images in EMF format. These can be either produced by the emf terminal, or by selecting ’Save as EMF...’ from the toolbar of the graph window of the windows terminal.
OpenOffice.org can also read SVG, as well as AutoCAD’s dxf format.
There are many ways to use gnuplot to produce graphs for inclusion in a TEX or LATEX document. Some terminals produce *.tex fragments for direct inclusion; others produce *.eps, *.pdf, *.png output to be included using the \includegraphics command. The epslatex and cairolatex terminals produce both a graphics file (*.eps or *.pdf) and a *.tex document file that refers to it. Gnuplot version 4.6 has a tikz terminal type that produces full text and graphics when the output is processed with pdflatex.
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.
The mif terminal type produces output for FrameMaker.
This depends on the terminal type you use.
You may use the tgif terminal, which creates output suitable for reading within tgif (http://bourbon.usc.edu/tgif/), an interactive 2-D drawing tool under X11.
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.
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 gnuplot is linked with libgd 2.0.29 or newer the gif terminal can generate directly an animated GIF.
Otherwise, have a look at the tool whirlgif 3.04. 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: www.lcdf.org/~eddietwo/gifsicle or gifmerge the-labs.com/GIFMerge.
mpeg_encode will encode a sequence of images into an mpeg format movie.
Implicit graphs or curves cannot be plotted directly in gnuplot. However there is a workaround.
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.
A plot with filled area between two given curves can be easily obtained using the pseudo file ’+’ with filledcurves closed. The example below demonstrates this for two curves f(x) and g(x):
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 using statement to return an undefined value (0/0) if the inequality is not satisfied.
See the documentation for help filledcurves, help special-filenames, and help ternary and see fillbetween.dem in the demos directory.
You do set pm3d; splot ’a.dat’ and no plot but colorbox appears. Perhaps 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:
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~.
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.
There are also plotting styles with image and with rgbimage for plotting 2D color images.
Use the explicit (see also implicit) switch of the pm3d style:
Well, it is very simple even though it is hard to discover: unset clabel.
Another solution requires to write contours into a temporary file using set table.
Now, for drawing it in 2D, do
and for contours in 3D do
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 gnuplot.sourceforge.net/scripts/index.html\#tricks-here.
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.
The last command deletes the two temporary files.
It is possible to draw colors facets of a 3D objects, organized in such a file:
Notice the positioning single and double blank line. <c> is an optional color.
Then plot it by (either of splot’s):
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.
Try set palette cubehelix.
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.
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 not built by default. If you want to use them, you’ll have to change file gnuplot/src/term.h, and recompile.
Yes.
Gnuplot supports various clustered and stacked histogram styles to display pretabulated data. It also offers a few options for accummulating raw data into bins, which can in turn be displayed as a bar chart. See the documentation for smooth frequency.
Pie charts are sort of difficult in gnuplot, but see http://gnuplot.sourceforge.net/demo/circles.html, or have a look at http://gnuplot-tricks.blogspot.com/2009/08/pie-charts-entirely-in-gnuplot.html.
Quarterly time charts are not possible in gnuplot, but have a look at ricardo.ecn.wfu.edu/~cottrell/qplot. The corresponding file qplot.zip can be obtained from the contrib directory on any gnuplot server.
Yes. set multiplot.
Yes. You can have 2 x- and 2 y-axes per plot. The additional axes are called x2 and y2. See help plot.
This is possible by the plot ~-~ possibility. The plot ~-~ command allows to read the data to be plot from standard input or the current batch job.
Most terminal types (output device drivers) support an "enhanced text" mode. This lets you use sub- and superscripts. It also allows to use Greek letters and math symbols to the extent that these are supported by the fonts installed on your system. The simplest way to enter special characters of any sort, if your system supports it, is to select UTF-8 encoding. This obviates the need to change 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.
To obtain accented characters like ü or in your labels you should use 8bit character codes together with the
appropriate encoding option. See the following example:
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 is very cumbersome for PostScript-based terminals.
Try set size square or set view equal xy.
Some terminals can, others can’t. Some allow you to choose a font size for the entire plot. Terminals supporting the "enhanced text" mode allow you to change fonts and text sizes within a plot. Look at the help for these terminals.
By specifying ? as a data value, as in
See also set missing. See also set datafile commentschars for specifying comment characters in data files.
This can be specified with various options for the command plot, for example plot ’a.dat’ every 2. If you want to draw a line through every point but only draw a point symbol at every nth point, then try plot ’a.dat’ with linespoints pointinterval n.
Depending on context, the main methods are:
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.9. If your data are not gridded, then use set dgrid3d {many options}.
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.
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.
The CVS development version may already contain fixes for bugs reported since the release of the current version. 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 can provide a simple script that reproduces the error, please upload it to the bug-tracker at sourceforge.net/tracker/?group_id=2055&atid=102055.
The tracker on sourceforge is for reporting bugs and collecting bug fixes that will appear in a subsequent release. 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.
On systems supporting pipes, you can pipe commands to gnuplot from other programs. Many applications with gnuplot as the graphics engine, like Octave (www.octave.org), uses this method. This also works from a cgi script to drive gnuplot from a forms-based web page.
John Campbell (jdc@nauvax.ucc.nau.edu) 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.
Many extensions or patches are available on the "Patches" page of the gnuplot development site 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:
Gnuplot has been and is a plotting program, not a data processing or mathematical program suite. Therefore gnuplot can’t do that. Look into the demo file "bivariat.dem" for a basic implementation of an integration.
For more sophisticated data-processing read the next section.
gnuplot alone is not suited very well for this. One thing you might try is fudgit, an interactive multi-purpose fitting program written by Martin-D. Lacasse. It can use gnuplot as its graphics back end.
Michael Courtney has written a program called lsqrft, which uses the Levenberg-Marquardt - algorithm for fitting data to a function. It is available from hobbes.nmsu.edu in /pub/os2/apps/analysis/lsqrft15.zip; sources, which should compile on Unix, and executables for MS-DOS and OS/2 are available. There is an interface to the OS/2 presentation manager.
You might also want to look at the applications developed by the Software Tools Group (STG) at the National Center for Supercomputing Applications. Ftp to ftp.ncsa.uiuc.edu and get the file README.BROCHURE for more information.
You can also try pgperl, an integration of the PGPLOT plotting package with Perl 5. Information can be found at www.ast.cam.ac.uk/AAO/local/www/kgb/pgperl, the source is available from ftp.ast.cam.ac.uk in /pub/kgb/pgperl/ or linux.nrao.edu in /pub/packages/pgperl/.
Another possibility is Octave. To quote from its README: Octave is a high-level language, primarily intended for numerical computations. Octave is licensed under GPL, and in principle, it is a free Matlab clone. It provides a convenient command line interface for solving linear and nonlinear problems numerically. The latest released version of Octave is always available from www.octave.org. By the way, octave uses gnuplot as its plotting engine, so you get a data-processing program on top of gnuplot.
Finally, there is scilab at www.scilab.org doing about the same as matlab. It is free but copyrighted software.
If your mouse is not working, try to hit ’m’ in the interactive terminal to switch mousing on/off. See below for the list of supported interactive terminals.
If it still does not run, then either gnuplot has not been configured or compiled with mouse support, or you have not properly installed it, or running an older version of gnuplot (check your PATH).
Most of the interactive terminals support both pre-defined and user-defined hotkeys to replot, toggle plot elements, change axis scaling, and so on. Hit ’h’ in an active gnuplot plot window to get list of hotkeys. Read help mouse and help bind for more information.
The preferred way of submitting, commenting and upgrading patches is via ’Patches’ section on sourceforge.net/tracker/?group_id=2055&atid=302055. You may want to send a note to gnuplot-beta@lists.sourceforge.net for more lively discussion.
Join the gnuplot beta test mailing list by sending a mail containing the line subscribe gnuplot-beta in the body (not the subject) of the mail to Majordomo@lists.sourceforge.net.
Please submit your questions (along with the answer) to gnuplot-beta@lists.sourceforge.net.
Use a parametric plot. An example:
You can also use gnuplot’s ability to ignore mathematically undefined expressions: the expression 1/0 is silently ignored, thus a construction like
plots a quadratic function only for |x| < 0.5.
If your system supports the popen() function, as Unix does, you should be able to run the output through another process, for example a short awk program, such as
The plot command is very powerful and is able to do some arithmetic on datafiles. See help plot.
The above filtering works seamlessly under Unixes and OS/2. On Windows, this is only supported by the console version gnuplot or the GUI version wgnuplot_pipes, which has an additional text console attached. The Cygwin version of gnuplot naturally supports pipes as well.
Use the save and load commands for this; see help save and help load for details.
You can save the current terminal and restore it later without touching the filesystem by set term push and set term pop, respectively.
If the data in a data file for splot is arranged in such a way that each one has the same number of data points (using blank lines as delimiters, as usual), splot will plot the data with a grid. If you want to plot just lines, use a different number of data entries (you can do this by doubling the last data point, for example).
An example:
Most gnuplot features are controlled by a corresponding set/unset command. If a feature is enabled by default, or by using set <feature>, then you should be able to turn it by using set no<feature>. However, the preferred syntax since version 4.0 is unset <feature>.
On unix-like systems, commands to gnuplot can be piped via stdin. Output from gnuplot’s print command can be read via a named pipe. On Windows, due to the lacking standard input (stdin) in GUI programs, you either need to use the console version gnuplot (recommended), or use wgnuplot_pipes, which has an additional console window attached. The old helper program pgnuplot is still included in the distribution package.
The most straightforward way is to use a UTF-8 font, and type in the ℏ character (Unicode code point #x210F) directly.
This does not work in PostScript, however, so you must use approximations like @{/=56 -} {/=24 h} or {/=8 @{/Symbol=24 -} _{/=14 h}} In the latter, the "-" (a long one in /Symbol) is non-spacing and 24-pt. The 14-pt "h" is offset by an 8-pt space (which is the space preceding the "_") but smaller, since it’s written as a subscript. But these don’t look too much like the hbar we’re used to, since the bar is horizontal instead of sloped. I don’t see a way to get that. I tried using an accent (character 264 in iso-latin-1 encoding), but I haven’t found a way to scale and position the pieces correctly. One more possibility would be {/=14 @^{/Symbol=10 -}{/=14 h}}.
The reduced Planck’s constant can be set very easily by using the AMS-LaTeX PostScript fonts which are available from www.ams.org/tex/amsfonts.html (also included in many LaTeX distributions). Gnuplot (see help fontpath) and the PostScript interpreter (usually Ghostscript) have to know where the file msbm10.pfb (or msbm10.pfa) resides. Use {/MSBM10 \175} to produce \hslash which is a "h" superimposed by a sloped bar. The standard \hbar (horizontal bar) has the octal code 176. Please note that h-bar exists only as an italic type.
As with Planck’s constant, the most straightforward way is to use a UTF-8 font, and type in the ⊙ character (Unicode code point #x2299 ; "circled dot operator") directly. The very similar glyph at code point #x2609 ; "sun" may be even better, but not many fonts have it.
Well, you probably don’t want a blank page, but page with a just a title (overprinting title in another graph in multiplot page):
Specify the position of the top, bottom, left, and right borders in terms of their fractional position within the page:
Gnuplot does not do font handling by itself; it must necessarily leave that to the individual device support libraries. Unfortunately, this means that different terminal types need different help in finding fonts. Here are some quick hints. For more detailed information please see the gnuplot documentation for the specific terminal type you are having problems with.
On VMS, you need to make several symbols:
Then run gnuplot from your command line, and use set term x11.
If you run gnuplot on Unix systems, be sure that the newest gnuplot_x11 is the first in your search path. Command which gnuplot_x11 will help you.
Gnuplot treats all numbers less than 1e-08 as zero, by default. Thus, if you are trying to plot a collection of very small numbers, they may be plotted as zero. Worse, if you’re plotting on a log scale, they will be off scale. Or, if the whole set of numbers is "zero", your range may be considered empty:
The solution is to change gnuplot’s idea of "zero":
For more information, type help set zero.
Obviously, it draws (unless there is an error in the script file), but the plot dissappears immediately when the script is completed.
Solution 1: Put a pause -1 after the plot command in the file, or at the file end.
Solution 2: Use command gnuplot filename.gp - (yes, dash is the last parameter) to stay in the interactive regime when the script completes.
Solution 3A: On an X-Window System system, you can also use the -persist option, the X11 window is then not closed. Close the X11 window by typing "q" when the focus is on it.
Solution 3B: On M$ Windows, you can also use either -persist or /noend.
Solution 4: For OS/2 PM terminal, use set term pm persist or set term pm server. For X11 terminal, use set term x11 persist.
Gnuplot does integer, and not floating point, arithmetic on integer expressions. For example, the expression 1/3 evaluates to zero. If you want floating point expressions, supply trailing dots for your floating point numbers. Example:
This way of evaluating integer expressions is shared by both C and Fortran.
You may need to flush the output with a closing set output. Some output formats (postscript, pdf, latex, svg, ...) can include several pages of plots in a single output file. For these output modes, gnuplot leaves the file open after each plot so that you can add additional plots to it. The file is not completed and made available to external applications until you explicitly close it (set output or unset output), or select a different terminal type (set term) or exit gnuplot. Output formats that contain only a single ’page’ (png, emf, ...) should not suffer from this problem.
The LATEX2e-core no longer includes the commands "\Diamond" and "\Box"; they are included in the latexsym package. Other symbols are taken from the amssymb package. Both of these are part of the base distribution and thus part of any LaTeX implementation. Please remember to include these packages in your LaTeX document.
You can call gnuplot by using a short Perl-script like the following:
Gnuplot closes its plot window on exit. The close GP command is executed, and the plot window is closed even before you have a chance to look at it.
There are three solutions to this: first, use the pause -1 command in gnuplot before closing the pipe. Second, close the pipe only if you are sure that you don’t need gnuplot and its plot window anymore. Last, you can use the command line option -persist: this option leaves the X-Window System plot window open.
Gnuplot 3.7’s main contributors are (in alphabetical order) Hans-Bernhard Broeker, John Campbell, Robert Cunningham, David Denholm, Gershon Elber, Roger Fearick, Carsten Grammes, Lucas Hart, Lars Hecking, Thomas Koenig, David Kotz, Ed Kubaitis, Russell Lang, Alexander Lehmann, Alexander Mai, Carsten Steger, Tom Tkacik, Jos Van der Woude, James R. Van Zandt, and Alex Woo. Additional substantial contributors to version 4.0 include Ethan Merritt, Petr Mikulík and Johannes Zellner. Version 4.2, 4.4 and 4.6 releases were coordinated by Ethan Merritt.
This list was initially compiled by John Fletcher with contributions from Russell Lang, John Campbell, David Kotz, Rob Cunningham, Daniel Lewart and Alex Woo. Reworked by Thomas Koenig from a draft by Alex Woo, with corrections and additions from Alex Woo, John Campbell, Russell Lang, David Kotz and many corrections from Daniel Lewart. Again reworked for gnuplot 3.7 by Alexander Mai and Juergen v.Hagen with corrections by Lars Hecking, Hans-Bernhard Broecker and other people. Revised for gnuplot 4.0 release by Petr Mikulík and Ethan Merritt. Revised for gnuplot 4.2 release by Petr Mikulík and Ethan Merritt. Revised for gnuplot 4.4 and 4.6 releases by Ethan Merritt.