📄 faq.txt
字号:
set term table
set out 'contour.dat'
set contour base; set cntrparam level 20
unset surface
splot x*x-y*y
set out; set term pop
# Change single blank lines to double blank lines
!awk "NF<2{printf\"\n\"}{print}" <contour.dat >contour1.dat
# Draw the plot
reset
set palette gray
set palette gamma 2.5
set pm3d map
set pm3d explicit
splot x*x+y*y with pm3d, 'contour1.dat' with line -1
!rm contour.dat contour1.dat
The last command deletes the two temporary files.
3.15 Color facets with pm3d
It is possible to draw colors facets of a 3D objects, organized in such a
file:
# triangle 1
x0 y0 z0 <c0>
x1 y1 z1 <c1>
x2 y2 z2 <c2>
x2 y2 z2 <c2>
# triangle 2
x y z
...
Notice the positioning single and double blank line. <c> is an optional
color.
Then plot it by (either of splot's):
set pm3d
set style data pm3d
splot 'facets.dat'
splot 'facets_with_color.dat' using 1:2:3:4
Note that you avoid surface lines by set style data pm3d or splot ... with
pm3d.
In the above example, pm3d displays triangles as independent surfaces.
They are plotted one surface after another as found in the data file.
Parts overlapping in 2D projection are overdrawn.
Gnuplot is not 3D modeling program. Its hidden routines apply for points
and lines, but not for faces. Without handling the data as a collection of
faces, there would be no surface anything could be hidden behind. The
'hidden3d' algorithm works by using the input data in two ways: first, to
set up a collection of triangles (made from a mesh of quadrangles) that
form the surface, second as a collection of edges. It then goes through
all those edges, checking what parts of them are not hidden behind any
faces, and draws those.
Consequently, gnuplot won't draw your surface or 3D object as a virtual
reality. It works OK for set pm3d map but for true 3D you would be
probably more happy writing a convertor of your facets into a VRML file.
3.16 Palette for printing my color map on color as well as blank&white printer?
I think it is this one, for example: set palette rgbformulae -25,-24,-32.
Can somebody prove this?
4 Wanted features
4.1 What's new in gnuplot 3.7, 4.0 etc?
Too many things to be named here. Please refer to the NEWS file in the
source distribution, or the News section in the gnuplot documentation.
4.2 Does gnuplot support a driver for <graphics format>?
To see a list of the available graphic drivers for your installation of
gnuplot, type set term.
Some graphics drivers are included in the normal distribution, but are
uncommented by default. If you want to use them, you'll have to change
file gnuplot/src/term.h, and recompile.
4.3 Does gnuplot have hidden line removal?
Version 3.7 supports hidden line removal on all platforms; use the command
set hidden3d.
The 16-bit binaries of gnuplot support the hidden line removal only
partially as the hidden-line algorithm may hit the 640k memory limit.
4.4 Does gnuplot support bar-charts/histograms/boxes?
Use the style with boxes for bar charts. To get filled boxes, use set
style fill.
Bernhard Reiter wrote an AWK script to post-process fig-terminal output.
Please have a look at
http://www.usf.uni-osnabrueck.de/ breiter/tools/gnuplot/barcharts.en.html.
There is a large patch (#606169) against the development version on
SourceForge awaiting inclusion in a future release of gnuplot. This adds a
new plotting style with histograms, and supports both clustered histograms
and stacked histograms.
4.5 Does gnuplot support pie charts?
It's not possible in gnuplot, but have a look at
http://www.usf.uni-osnabrueck.de/ breiter/tools/piechart/piecharts.en.html
4.6 Does gnuplot quarterly time charts?
It's not possible in gnuplot, but have a look at
http://ricardo.ecn.wfu.edu/ cottrell/qplot. The corresponding file
qplot.zip can be obtained from the contrib directory on any gnuplot
server.
4.7 Can I put multiple pages on one page?
Yes. set multiplot.
If you use the postscript terminal and plot one graph per page you can use
the program mpage (http://www.mesa.nl/pub/mpage) to print multiple logical
pages per physical page. A similar program is the psnup program in the
psutils package. This package is available at any CTAN mirror.
4.8 Does gnuplot support multiple y-axes on a single plot?
Yes. You can have 2 x- and 2 y-axes per plot. The additional axes are
called x2 and y2. See help plot.
4.9 Can I put both commands and data into a single file?
This is possible by the new plot "-" possibility. The plot "-" command
allows to read the data to be plot from standard input or the current
batch job.
gnuplot> plot "-"
1 1
2 4
3 9
e
4.10 Can I put Greek letters and super/subscripts into my labels?
The enhanced option in some terminals (currently postscript, Presentation
Manager, png, pdf, and x11) lets you use sub- and superscripts. It also
allows to use Greek letters and symbols via symbol fonts, to the extent
that these are supported by the underlying font libraries on your system.
Versions through 2.0.15 of libgd (needed for png and jpeg) must be patched
in order to handle symbol fonts.
You might try using the LATEX terminal type and putting text like
"\\alpha_{3}" or '\alpha_{3}' . If you include your gnuplot-graphs into a
LATEX document you can use the LATEX-package psfrag to typeset any
characters into your graphs.
One more possibility is to use the MetaPost terminal. It supports TEX
syntax and is converted onto encapsulated PostScript by mpost.
4.11 How do I include accented characters
To obtain accented characters like u: or n in your labels you should use
8bit character codes together with the appropriate encoding option. See
the following example:
gnuplot> set encoding iso_8859_1
gnuplot> set title "M\374nchner Bierverbrauch \374ber die Jahre"
gnuplot> plot "bier.dat" u 1:2
Consequently, you can type labels in Czech, French, Hungarian, Russian...
by means of an appropriate set encoding. However, you cannot mix two
encodings in one file (e.g. accents for west and east latin encodings).
That you can only do with a TEX output.
4.12 Can I do 1:1 scaling of axes?
Use set size square.
4.13 Can I put different text sizes into my plots?
Some terminals can, others can't. Some allow you to choose a font size for
the entire plot. Terminals supporting the "enhanced text" mode (like
postscript, pm, x11, png, pdf) allow you to change fonts and text sizes
within a plot. Look at the help for these terminals.
4.14 How do I skip data points?
By specifying ? as a data value, as in
1 2
2 3
3 ?
4 5
See also set missing. See also set datafile commentschars for specifying
comment characters in data files.
4.15 How do I plot every nth point?
This can be specified with various options for the command plot, for
example plot 'a.dat' every 2.
4.16 How do I plot a vertical line?
Depending on context, the main methods are:
* set arrow .... .... nohead where you have to compute explicitly the
start and the end of the arrow.
* generate (inlined) datapoints and plot them
* switch to parametric mode
4.17 How do I plot data files
Easily: by a command plot 'a.dat'. In 3D, use splot 'a.dat' - but don't
forget to put a blank line in between two subsequent scans (isolines),
otherwise you will get an error that the data is not gridded; see also
question 3.10. If your data are not gridded, then use set dgrid3d {many
options}.
4.18 How do I replot multiplot drawing
You cannot directly: gnuplot supports replot command, not remultiplot. You
have to write the complete sequence of commands since set multiplot till
unset multiplot into a script file. Then you can load the script into
gnuplot as many times as you need for replotting the drawing to different
terminals or output files.
5 Miscellaneous
5.1 I've found a bug, what do I do?
First, try to see whether it actually is a bug, or whether it is a feature
which may be turned off by some obscure set-command.
Next, see whether you have an old version of gnuplot; if you do, chances
are the bug has been fixed in a newer release.
Fixes for bugs reported since the release of the current version are held
in the patches directory at gnuplot distribution sites. Before submitting
a bug report, please check whether the bug in question has already been
fixed.
If, after checking these things, you still are convinced that there is a
bug, proceed as follows. If you have a fairly general sort of bug report,
posting to ~comp.graphics.apps.gnuplot is probably the way to go. If you
have investigated a problem in detail, especially if you have a context or
unified diff that fixes the problem, please e-email a report to
gnuplot-bug@lists.sourceforge.net.
The bug-gnuplot list is for reporting and collecting bug fixes, the
~comp.graphics.apps.gnuplot newsgroup will be more help for finding work
arounds or actually solving gnuplot related problems. If you do send in a
bug report, be sure and include the version of gnuplot (including
patchlevel) as shown by the command show version long, terminal driver,
operating system, an exact description of the bug and input which can
reproduce the bug. Failure to indicate these details can render a solution
to your problem almost impossible. Also, any context diffs should be
referenced against the latest official version of gnuplot if at all
possible.
5.2 Can I use gnuplot routines for my own programs?
On systems supporting pipes, you can pipe commands to gnuplot from other
programs. Many applications with gnuplot as the graphics engine, like
Octave (http://www.octave.org), uses this method. This also works from a
cgi script to drive gnuplot from a forms-based web page.
John Campbell 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.
5.3 What extensions have people made to gnuplot? Where can I get them?
Many extensions or patches are available on the "Patches" page of the
gnuplot development site
http://sourceforge.net/tracker/?group_id=2055&atid=302055. The current
development version will generally include some of these being debugged
for inclusion in a later official release of gnuplot.
Older extensions, which may or may not work with the current version, are
available from ftp.ucc.ie in /pub/gnuplot/contrib/.
Some extensions available:
* barchart_via_fig: awk scripts to produce barcharts with filled boxes.
* date-errorbar: allows dates in the hi/lo fields for errorbars.
* perltk: A perl/tk canvas widget.
* polyg.patch: Implements a polygon plotting style.
* xgfe: graphical front end using the Qt widgets available at
http://www.tug.org/tex-archive/graphics/gnuplot/contrib/.
* Gnuplot.py: A python package to create graphs from within python. More
information at http://gnuplot-py.sourceforge.net.
5.4 I need an integration, fft, iir-filter,...!
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.
5.5 Can I do heavy-duty data processing with gnuplot? or What is beyond gnuplot?
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 (isaac@frodo.physics.mcgill.ca). It can use gnuplot as its
graphics back end and is available from ftp.physics.mcgill.ca in
/pub/Fudgit/fudgit_2.33.tar.Z and from the main Linux server,
tsx-11.mit.edu and its numerous mirrors around the world as
/pub/linux/sources/usr.bin/fudgit-2.33.tar.z. Versions are available for
AIX, Data General, HP-UX, IRIX 4, Linux, NeXT, Sun3, Sun4, Ultrix, OS/2
and MS-DOS. The MS-DOS version is available on simtel20 mirrors (simtel20
itself has closed down) in the "math" subdirectory as fudg_231.zip.
Carsten Grammes has written a fitting program which has been merged into
gnuplot 3.7.
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
http://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/.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -