⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 faq.txt

📁 智能画图软件
💻 TXT
📖 第 1 页 / 共 4 页
字号:
   browsing or printing.

   Online gnuplot documentation is available at
   http://gnuplot.sourceforge.net/documentation.html.

   (Obsolete?) PostScript copies of the documentation can be ftp'd from
   ftp.gnuplot.info in /pub/gnuplot, as manual.ps.Z and tutorial.ps.Z.
   Documentation about gnuplot is available at the gnuplot distribution sites
   in the files gpdoc.zip and gpdoc2.zip.

2.6 Worked examples

   There is a directory of worked examples in the the source distribution.
   These examples, and the resulting plots, may also be found at
   http://gnuplot.sourceforge.net/demo/.

2.7 How do I modify gnuplot, and apply 'patches'?

   For this, you will need to recompile gnuplot.

   Modifications people make are either done by replacing files, such as
   terminal drivers, or by 'patching'. If a file is a replacement, it will
   probably tell you in its README or in the lines at the beginning.

   To patch a file, you need the patch utility, and possibly also automake
   and autoconf. On many UNIX systems these will already be installed; If
   they aren't, you can find them wherever GNU software is archived. Typical
   command for applying a patch is patch -p0 <newfunctionality.diff.

   There is repository of contributed patches in the "Patches" section on
   gnuplot's sourceforge site http://www.sourceforge.net/projects/gnuplot/.


3 Working with it.

3.1 How do I get help?

   Read this document.

   Give the help command at the initial prompt. After that, keep looking
   through the keywords. Good starting points are plot and set.

   Read the manual, if you have it.

   Look through the demo subdirectory; it should give you some ideas.

   Ask your colleagues, the system administrator or the person who set up
   gnuplot.

   If all these fail, please upgrade to the newest version of gnuplot or urge
   your system-administrator to do so. Then post a question
   to ~comp.graphics.apps.gnuplot or send mail to the gatewayed mailing list
   gnuplot-info@lists.sourceforge.net. Do not forget to cite the version
   number and the operating system. If you want to subscribe to the mailing
   list, send a mail to majordomo@lists.sourceforge.net with the body of the
   message being subscribe info-gnuplot. Please don't do this if you can get
    ~comp.graphics.apps.gnuplot directly. If you post a question there, it is
   considered good form to solicit e-mail replies and post a summary.

3.2 How do I print out my graphs?

   The kind of output produced is determined by the set terminal command; for
   example, set terminal postscript will produce the graph in PostScript
   format. Output can be redirected using the set output command.

   As an example, the following prints out a graph of sin(x) on a Unix
   machine running the X-Window System.

 gnuplot> plot [-6:6] sin(x)
 gnuplot> set terminal postscript
 Terminal type set to 'postscript'
 Options are 'landscape monochrome "Courier" 14'
 gnuplot> set output "sin.ps"
 gnuplot> replot
 gnuplot> set output              # set output back to default
 gnuplot> set terminal x11        # ditto for terminal type
 gnuplot> ! lp -ops sin.ps        # print PS File (site dependent)
 request id is lprint-3433 (standard input)
 lp: printed file sin.ps on fg20.rz.uni-karlsruhe.de (5068 Byte)
 !
 gnuplot>

   Using the platform-independent way of restoring terminal by set term
   push/pop commands, do it by

 gnuplot> set terminal postscript eps color lw 15 "Helvetica" 20
 gnuplot> set out 'a.eps'
 gnuplot> replot
 gnuplot> set term pop

   The command set term pop without a previous corresponding set term push
   switches the terminal back to the startup terminal, e.g. x11, pm or win.

   In Microschrott Windows you click in the upper left corner of the graph
   window and print directly from there.

3.3 How do I include my graphs in <word processor>?

   Basically, you save your plot to a file in a format your word processor
   can understand (using set term and set output, see above), and then you
   read in the plot from your word processor. Vector formats (PostScript,
   emf, svg, pdf, TEX, LATEX, etc) should be preferred, as you can scale your
   graph later to the right size.

   Details depend on which word processor you use; use set term to get a list
   of available file formats.

   Many word processors can use Encapsulated PostScript for graphs. This can
   be generated by the set terminal postscript eps [color] command. Note that
   it is a good idea to check and correct the bounding box of the graphs in
   the eps files (manually or by the fixbb script from gnuplot webpage), as
   you have to correct this box for any eps figure produced by whichever
   program. Some (most?) word processors do not preview the actual image in
   the eps file, and you have to add the preview image yourself. You can use
   the GSView viewer for this (available for OS/2, Windows and X11), or some
   Unix ps tool. Note that the preview image increases size of the eps file;
   the smallest increase you may get by choosing Tiff 6 Packbits.

   Into some office applications, like OpenOffice.org, or into applications
   in the Windows world, you can insert vectorial images produces by the emf
   terminal type.

   With TEX, it depends on what you use to print your dvi files. If you use
   dvips or dvi2ps, you can use Encapsulated PostScript. For emTeX (popular
   for OS/2 and MS-DOS), you can use emTeX, otherwise use the LATEX terminal
   type, which generates a picture environment. You can also use epslatex to
   separate the graphics and text parts. Other possibilities include pslatex
   or pstex terminals, and metafont or metapost terminals.

   With TEX processed by pdftex or pdflatex, you can use png, jpeg and pdf
   terminal types. You can also use the postscript eps terminal and convert
   the eps file externally to pdf by epstopdf. Another choice is the epslatex
   terminal, after converting the eps part to pdf as above (the TEX part can
   remain unchanged).

   Most word processors can import bitmap images (png, pbm, etc). The
   disadvantage of this approach is that the resolution of your plot is
   limited by the size of the plot at the time it is generated by gnuplot,
   which is generally a much lower resolution than the document will
   eventually be printed in.

   Under IBM OS/2, MacOS and Micro$oft Windows you can use the clipboard to
   copy your graph and paste it into your favourite word processor.

   The mif terminal type produces output for FrameMaker.

3.4 How do I edit or post-process a gnuplot graph?

   This depends on the terminal type you use.

     * X11 toolkits: You can use the terminal type fig and use the xfig
       drawing program to edit the plot afterwards. You can obtain the xfig
       program from its web site http://www.xfig.org. More information about
       the text-format used for fig can be found in the fig-package.

       You may use the tgif terminal, which creates output suitable for
       reading within tgif (http://bourbon.cs.umd.edu:8001/tgif/), an
       interactive 2-D drawing tool under X11.

     * You may use the svg terminal (scalable vector graphics), which can be
       further edited by a svg editor, e.g. Sodipodi
       (http://sodipodi.sourceforge.net), Sketch
       (http://sketch.sourceforge.net) or Dia
       (http://http://www.lysator.liu.se/ alla/dia).

     * PostScript or PDF output can be edited directly by tools such as Adobe
       Illustrator or Acrobat, or can be converted to a variety of other
       editable vector formats by the pstoedit package. Pstoedit is available
       at http://www.pstoedit.net.

     * The mif terminal type produces an editable FrameMaker document.

     * Bitmapped graphics (e.g. png, jpeg, pbm) can be edited using tools
       such as ImageMagick or Gimp. In general, you should use a vector
       graphics program to post-process vector graphic formats, and a
       pixel-based editing program to post-process pixel graphics.

3.5 How do I change symbol size, line thickness and the like?

   Gnuplot offers a variety of commands to set line and point properties,
   including color, thickness, point shape, etc. The command test will
   display a test page for the currently selected terminal type showing the
   available pre-defined combinations of color, size, shape, etc. The set
   style command can be used to define additional combinations.

3.6 How do I generate plots in GIF format?

   GIF support was provided by an external library, libgd. Version 1.6 of the
   gd library dropped support for gif in favour of the superior png format.
   More recent versions of libgd also support jpeg output. If your
   installation of gnuplot is linked to the gd library, you will get support
   for whatever formats (gif, png, jpeg) are in that version of libgd.

   Thus, nowadays, the usual way is to output the image as png and then use
   your favourite program to convert it into gif, either using command line
   (e.g. convert f.png f.gif or nconvert -out gif f.png) or by any GUI
   program. Another possibility is to output the image as (encapsulated)
   postscript and convert (export) it into gif or png by ghostscript, e.g.
   convert -density 150 f.eps f.gif or by any ghostscript-based GUI like
   gsview, gv or kghostview.

3.7 Can I animate my graphs?

   First have a look at animate.dem in the demo directory of gnuplot.
   Basically, animated graphs are a sequence of plots in a suitable format.

   Then have a look at the tool whirlgif 3.04, available at
   http://www.danbbs.dk/ dino/whirlgif. It reads run-length encoded gifs and
   packs them into a minimal animation. On the web-pages you will find a
   manual and an example.

   You can also write a small script to get gnuplot to output a family of GIF
   files, then have it execute some animator such as gifsicle:
   http://www.lcdf.org/ eddietwo/gifsicle or gifmerge
   http://the-labs.com/GIFMerge.

   mpeg_encode will encode a sequence of images into an mpeg format movie.

3.8 How do I plot implicit defined graphs?

   Implicit graphs or curves cannot be plotted directly in gnuplot. However
   there is a workaround.

 gnuplot> # as example. Place your definition in the following line
 gnuplot> f(x,y) = y - x**2 / tan(y)
 gnuplot> set contour base
 gnuplot> set cntrparam levels discrete 0.0
 gnuplot> set nosurface
 gnuplot> set term table
 gnuplot> set out 'curve.dat'
 gnuplot> splot f(x,y)
 gnuplot> set out
 gnuplot> set term pop
 gnuplot> plot 'curve.dat' w l

   The trick is to draw the single contour line z=0 of the surface z=f(x,y),
   and store the resulting contour curve to a gnuplot datafile.

3.9 How to fill an area between two curves

   A plot with filled area between two given curves requires a parametric
   plot with filledcurves closed. The example below demonstrates this for two
   curves f(x) and g(x) with a tricky "folded" parameter t:

 set parametric
 f(x)=cos(x)
 g(x)=sin(x)
 xmax=pi/4
 set xrange [0:xmax]
 set trange [0:2*xmax]
 path(t) = ( t<= xmax ? f(t) : g(2*xmax-t) )
 fold(t) = (t <=xmax ? t : 2*xmax - t)
 plot fold(t),path(t) with filledcurves closed

   Note that the above code fills area between the two curves, not area
   satisfying inequality g(x)<f(x). If you want the latter, you should use
   the ternary operator in path(t) to return an undefined value (0/0) if the
   inequality is not satisfied.

   See the documentation for help parametric, help filledcurves, and help
   ternary.

3.10 Pm3d splot from a datafile does not draw anything

   You do set pm3d; splot 'a.dat' and no plot but colorbox appears.
   Obviously, there is no blank line in between two subsequent scans
   (isolines) in the data file. Add blank lines! If you are curious what this
   means, then don't hesitate to look to files like demo/glass.dat or
   demo/triangle.dat in the gnuplot demo directory.

   You can find useful the following awk script (call it e.g. addblanks.awk)
   which adds blank lines to a data file whenever number in the first column
   changes:

 /[:blank:]*#/ {next} # ignore comments (lines starting with #)
 NF < 3 {next} # ignore lines which don't have at least 3 columns
 $1 != prev {printf "\n"; prev=$1} # print blank line
 {print} # print the line

   Then, either preprocess your data file by command awk -f addblanks.awk
   <a.dat or plot the datafile under a unixish platform by gnuplot> splot
   "<awk -f addblanks.awk a.dat".

3.11 Drawing a (color) map, i.e. 2D projection of 3D data

   Use set view map; unset surface or set pm3d map rather than set view
   180,0. The latter facilitates drawing matrices or data files as maps, even
   without the necessity for matrix-like data organization (gridding). It is
   possible to decrease the output postscript file size by postprocessing it
   by pm3dCompress.awk or pm3dConvertToImage.awk.

   Note there is a new plotting style with image for plotting 2D color images
   with support for almost arbitrary text or binary files in "Patches"
   section on gnuplot's sourceforge site
   http://www.sourceforge.net/projects/gnuplot/.

3.12 How to overlay dots/points scatter plot onto a pm3d map/surface

   Use the explicit (see also implicit) switch of the pm3d style:

 gnuplot> set pm3d explicit
 gnuplot> splot x with pm3d, x*y with points

3.13 How to draw black contour plot, and contours with labels

   Drawing contour plot in one colour requires to write contours into a
   temporary file using the table terminal:

 set contour base; set cntrparam levels 15; unset surface; set view map
 splot x*x+y*y; pause -1
 set term table; set out 'contour.dat'
 replot; set out; set term pop

   Now, for drawing it in 2D, do

 reset
 plot 'contour.dat' with line -1

   end for contours in 3D do

 reset
 # Change single blank lines to double blank lines
 !awk "NF<2{printf\"\n\"}{print}" <contour.dat >contour1.dat
 plot 'contour1.dat' with line -1

   See also the following question "How to overlay contour plot over pm3d
   map/surface".

   Labelling contours by their z-value can be achieved by a suitable script
   generating automatically the appropriate set label commands; you can find
   one at gnuplot scripts page
   http://gnuplot.sourceforge.net/scripts/index.html#tricks-here.

3.14 How to overlay contour plot over pm3d map/surface

   It is necessary to write contours into a temporary file using the table
   terminal, and then use this file in the final drawing without set
   contours. The following example demonstrates this for a map; for surface,
   remove set pm3d map and put set ticslevel 0.

 # Write contours of function  x*x-y*y  to a (temporary) file

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -