► Plotting two-dimensional functions and data points in many different styles (points, lines, error bars)
► Plotting three-dimensional data points and surfaces in many different styles (contour plot, mesh)
► Algebraic computation in integer, float and complex arithmetic
► User-defined functions and hot-keys
► Support for a large number of operating systems, graphics file formats and output devices
► Extensive on-line help
► TEX-like text formatting for labels, titles, axes, data points
► Interactive command line editing and history (most platforms)
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.
GIF support is provided by an external library, libgd (http://www.libgd.org). Old versions of gd (versions 1.2 to 1.4) produce only GIF output. Versions 1.6 to 2.0.27 did not support GIF output because of patent concerns. However versions 1.6 and newer support PNG outputs, and 1.7 and newer support JPEG outputs. Version 2.0.28 of the Boutell gd library restored GIF functionality, and 2.0.29 added support for GIF animation. If your installation of gnuplot is linked to the gd library, you will get support for whatever formats (GIF, PNG, JPEG) are in that version of gd.
In any case, it is easy to convert from one format to another. To convert a PNG output into GIF, you can either use the command line (e.g. convert f.png f.gif or nconvert -out gif f.png) or any GUI program. Another possibility is to output the image as (encapsulated) postscript and convert (export) it into GIF or PNG by ghostscript, e.g. convert -density 150 f.eps f.gif or by any ghostscript-based GUI like gsview, gv or kghostview.
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 MS Windows you can click in the upper left corner of the graph window and print directly from there.
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 gd 2.0.29 or newer (see previous entry), the gif terminal can generate directly an animated GIF.
Otherwise, have a look at the tool whirlgif 3.04, available at http://www.danbbs.dk/ dino/whirlgif. It reads run-length encoded GIF files and packs them into a minimal animation. On the web-pages you will find a manual and an example.
You can also write a small script to get gnuplot to output a family of GIF files, then have it execute some animator such as gifsicle: http://www.lcdf.org/ eddietwo/gifsicle or gifmerge http://the-labs.com/GIFMerge.
mpeg_encode will encode a sequence of images into an mpeg format movie.
Webmaster 22nd of May 2012
Tell us what you feel about Gnuplot Programming Interview Questions and Answers
All comments will be published after review. No login or registration is required to post a comment on Gnuplot Programming Interview Questions and Answers We offer and invite you to submit your valuable comment now; Please be respectful of others when commenting. Insulting others, self-promotional comments, website promotional comments, marketing stuff, SEO Techniques, SMS-style content and off-topic comments will not be approved at this information portal.
So start sharing your thoughts regarding Gnuplot Programming Interview Questions and Answers
Thank you.