Gnuplot supports a large number of output formats. These are selected by choosing an appropriate terminal type, possibly with additional modifying options. See set terminal.
This document may describe terminal types that are not available to you because they were not configured or installed on your system. To see a list of terminals available on a particular gnuplot installation, type 'set terminal' with no modifiers.
Terminals marked legacy are not built by default in recent gnuplot versions and may not actually work.
NOTE: Legacy terminal, originally written for Adobe Illustrator 3.0+. Since Adobe Illustrator understands PostScript level 1 commands directly, you should use set terminal post level1 instead.
Syntax:
set terminal aifm {color|monochrome} {"<fontname>"} {<fontsize>}
This terminal relies on AquaTerm.app for display on Mac OS X.
Syntax:
set terminal aqua {<n>} {title "<wintitle>"} {size <x> <y>} {font "<fontname>{,<fontsize>}"} {linewidth <lw>}"} {{no}enhanced} {solid|dashed} {dl <dashlength>}}
where <n> is the number of the window to draw in (default is 0), <wintitle> is the name shown in the title bar (default "Figure <n>"), <x> <y> is the size of the plot (default is 846x594 pt = 11.75x8.25 in).
Use <fontname> to specify the font (default is "Times-Roman"), and <fontsize> to specify the font size (default is 14.0 pt).
The aqua terminal supports enhanced text mode (see enhanced), except for overprint. Font support is limited to the fonts available on the system. Character encoding can be selected by set encoding and currently supports iso_latin_1, iso_latin_2, cp1250, and UTF8 (default).
Lines can be drawn either solid or dashed, (default is solid) and the dash spacing can be modified by <dashlength> which is a multiplier > 0.
The be terminal type is present if gnuplot is built for the beos operating system and for use with X servers. It is selected at program startup if the DISPLAY environment variable is set, if the TERM environment variable is set to xterm, or if the -display command line option is used.
Syntax:
set terminal be {reset} {<n>}
Multiple plot windows are supported: set terminal be <n> directs the output to plot window number n. If n>0, the terminal number will be appended to the window title and the icon will be labeled gplt <n>. The active window may distinguished by a change in cursor (from default to crosshair.)
Plot windows remain open even when the gnuplot driver is changed to a different device. A plot window can be closed by pressing the letter q while that window has input focus, or by choosing close from a window manager menu. All plot windows can be closed by specifying reset, which actually terminates the subprocess which maintains the windows (unless -persist was specified).
Plot windows will automatically be closed at the end of the session unless the -persist option was given.
The size or aspect ratio of a plot may be changed by resizing the gnuplot window.
Linewidths and pointsizes may be changed from within gnuplot with set linestyle.
For terminal type be, gnuplot accepts (when initialized) the standard X Toolkit options and resources such as geometry, font, and name from the command line arguments or a configuration file. See the X(1) man page (or its equivalent) for a description of such options.
A number of other gnuplot options are available for the be terminal. These may be specified either as command-line options when gnuplot is invoked or as resources in the configuration file ".Xdefaults". They are set upon initialization and cannot be altered during a gnuplot session.
In addition to the X Toolkit options, the following options may be specified on the command line when starting gnuplot or as resources in your ".Xdefaults" file:
The options are shown above in their command-line syntax. When entered as resources in ".Xdefaults", they require a different syntax.
Example:
gnuplot*gray: on
gnuplot also provides a command line option (-pointsize <v>) and a resource, gnuplot*pointsize: <v>, to control the size of points plotted with the points plotting style. The value v is a real number (greater than 0 and less than or equal to ten) used as a scaling factor for point sizes. For example, -pointsize 2 uses points twice the default size, and -pointsize 0.5 uses points half the normal size.
For monochrome displays, gnuplot does not honor foreground or background colors. The default is black-on-white. -rv or gnuplot*reverseVideo: on requests white-on-black.
For color displays, gnuplot honors the following resources (shown here with their default values) or the greyscale resources. The values may be color names as listed in the BE rgb.txt file on your system, hexadecimal RGB color specifications (see BE documentation), or a color name followed by a comma and an intensity value from 0 to 1. For example, blue, 0.5 means a half intensity blue.
The command-line syntax for these is, for example,
Example:
gnuplot -background coral
When -gray is selected, gnuplot honors the following resources for grayscale or color displays (shown here with their default values). Note that the default background is black.
gnuplot honors the following resources for setting the width (in pixels) of plot lines (shown here with their default values.) 0 or 1 means a minimal width line of 1 pixel width. A value of 2 or 3 may improve the appearance of some plots.
gnuplot honors the following resources for setting the dash style used for plotting lines. 0 means a solid line. A two-digit number jk (j and k are >= 1 and <= 9) means a dashed line with a repeated pattern of j pixels on followed by k pixels off. For example, '16' is a "dotted" line with one pixel on followed by six pixels off. More elaborate on/off patterns can be specified with a four-digit value. For example, '4441' is four on, four off, four on, one off. The default values shown below are for monochrome displays or monochrome rendering on color or grayscale displays. For color displays, the default for each is 0 (solid line) except for axisDashes which defaults to a '16' dotted line.
[EXPERIMENTAL] The caca terminal is a mostly-for-fun output mode that uses libcaca to plot using ascii characters. In contrast to the dumb terminal it includes support for color, box fill, images, rotated text, filled polygons, and mouse interaction.
Syntax:
set terminal caca {{driver | format} {default | <driver> | list}} {color | monochrome} {{no}inverted} {enhanced | noenhanced} {background <rgb color>} {title "<plot window title>"} {size <width>,<height>} {charset ascii|blocks|unicode}
The driver option selects the libcaca display driver or export format. Use default is to let libcaca choose the platform default display driver. The default driver can be changed by setting the environment variable CACA_DRIVER before starting gnuplot. Use set term caca driver list to print a list of supported output modes.
The color and monochrome options select colored or mono output. Note that this also changes line symbols. Use the inverted option if you prefer a black background over the default white. This also changes the color of black default linetypes to white.
Enhanced text support can be activated using the enhanced option, see enhanced text.
The title of the output window can be changed with the title option, if supported by the libcaca driver.
The size option selects the size of the canvas in characters. The default is 80 by 25. If supported by the backend, the canvas size will be automatically adjusted to the current window/terminal size. The default size of the "x11" and "gl" window can be controlled via the CACA_GEOMETRY environment variable. The geometry of the window of the "win32" driver can be controlled and permanently changed via the app menu.
The charset option selects the character set used for lines, points, filling of polygons and boxes and dithering of images. Note that some backend/terminal/font combinations might not support some characters of the blocks or unicode character set. On Windows it is recommend to use a non-raster font such as "Lucida Console" or "Consolas".
The caca terminal supports mouse interaction. Please beware that some backends of libcaca (e.g. slang, ncurses) only update the mouse position on mouse clicks. Modifier keys (ctrl, alt, shift) are not supported by libcaca and are thus unavailable.
The default encoding of the caca terminal is utf8. It also supports the cp437 encoding.
The number of colors supported by libcaca backends differs. Most backends support 16 foreground and 16 background colors only, whereas e.g. the "x11" backend supports truecolor.
Depending on the terminal and libcaca backend, only 8 different background colors might be supported. Bright colors (with the most most significant bit of the background color set) are then interpreted as indicator for blinking text. Try using background rgb "gray" in that case.
See also the libcaca web site at
http://caca.zoy.org/wiki/libcaca
and libcaca environment variables
http://caca.zoy.org/doxygen/libcaca/libcaca-env.html
The caca terminal has known bugs and limitations:
Unicode support depends on the driver and the terminal. The "x11" backend supports unicode since libcaca version 0.99.beta17. Due to a bug in libcaca <0.99.beta20, the "slang" driver does not support unicode. Note that libcaca <0.99.beta19 contains a bug which results in an endless loop if you supply illegal 8bit sequences.
Bright background colors may cause blinking.
Modifier keys are not supported for mousing, see term caca.
Rotated enhanced text, and transparency are not supported. The size option is not considered for on-screen display.
In order to correctly draw the key box, use
set key width 1 height 1
Alignment of enhanced text is wrong if it contains utf8 characters. Resizing of Windows console window does not work correctly due to a bug in libcaca. Closing the terminal window by clicking the "X" on the title line will terminate wgnuplot. Press "q" to close the window.
The cairolatex terminal device generates encapsulated PostScript (*.eps) or PDF output using the cairo and pango support libraries and uses LaTeX for text output using the same routines as the epslatex terminal.
Syntax:
set terminal cairolatex {eps | pdf} {standalone | input} {blacktext | colortext | colourtext} {header <header> | noheader} {mono|color} {{no}transparent} {{no}crop} {background <rgbcolor>} {font <font>} {fontscale <scale>} {linewidth <lw>} {rounded|butt|square} {dashlength <dl>} {size <XX>{unit},<YY>{unit}}
The cairolatex terminal prints a plot like terminal epscairo or terminal pdfcairo but transfers the texts to LaTeX instead of including them in the graph. For reference of options not explained here see pdfcairo.
eps and pdf select the type of graphics output. Use eps with latex/dvips and pdf for pdflatex.
blacktext forces all text to be written in black even in color mode;
The cairolatex driver offers a special way of controlling text positioning: (a) If any text string begins with '{', you also need to include a '}' at the end of the text, and the whole text will be centered both horizontally and vertically by LaTeX. (b) If the text string begins with '[', you need to continue it with: a position specification (up to two out of t,b,l,r,c), ']{', the text itself, and finally, '}'. The text itself may be anything LaTeX can typeset as an LR-box. \rule{}{}'s may help for best positioning. See also the documentation for the pslatex terminal driver. To create multiline labels, use \shortstack, for example
set ylabel '[r]{\shortstack{first line \\ second line}}'
The back option of set label commands is handled slightly different than in other terminals. Labels using 'back' are printed behind all other elements of the plot while labels using 'front' are printed above everything else.
The driver produces two different files, one for the eps or pdf part of the figure and one for the LaTeX part. The name of the LaTeX file is taken from the set output command. The name of the eps/pdf file is derived by replacing the file extension (normally '.tex') with '.eps' or '.pdf' instead. There is no LaTeX output if no output file is given! Remember to close the output file before next plot unless in multiplot mode.
In your LaTeX documents use '\input{filename}' to include the figure. The '.eps' or '.pdf' file is included by the command \includegraphics{...}, so you must also include \usepackage{graphicx} in the LaTeX preamble. If you want to use coloured text (option colourtext) you also have to include \usepackage{color} in the LaTeX preamble.
The behaviour concerning font selection depends on the header mode. In all cases, the given font size is used for the calculation of proper spacing. When not using the standalone mode the actual LaTeX font and font size at the point of inclusion is taken, so use LaTeX commands for changing fonts. If you use e.g. 12pt as font size for your LaTeX document, use '", 12"' as options. The font name is ignored. If using standalone the given font and font size are used, see below for a detailed description.
If text is printed coloured is controlled by the TeX booleans \ifGPcolor and \ifGPblacktext. Only if \ifGPcolor is true and \ifGPblacktext is false, text is printed coloured. You may either change them in the generated TeX file or provide them globally in your TeX file, for example by using
\newif\ifGPblacktext \GPblacktexttrue
in the preamble of your document. The local assignment is only done if no global value is given.
When using the cairolatex terminal give the name of the TeX file in the set output command including the file extension (normally ".tex"). The graph filename is generated by replacing the extension.
If using the standalone mode a complete LaTeX header is added to the LaTeX file; and "-inc" is added to the filename of the gaph file. The standalone mode generates a TeX file that produces output with the correct size when using dvips, pdfTeX, or VTeX. The default, input, generates a file that has to be included into a LaTeX document using the \input command.
If a font other than "" or "default" is given it is interpreted as LaTeX font name. It contains up to three parts, separated by a comma: 'fontname,fontseries,fontshape'. If the default fontshape or fontseries are requested, they can be omitted. Thus, the real syntax for the fontname is '{fontname}{,fontseries}{,fontshape}'. The naming convention for all parts is given by the LaTeX font scheme. The fontname is 3 to 4 characters long and is built as follows: One character for the font vendor, two characters for the name of the font, and optionally one additional character for special fonts, e.g., 'j' for fonts with old-style numerals or 'x' for expert fonts. The names of many fonts is described in
http://www.tug.org/fontname/fontname.pdf
For example, 'cmr' stands for Computer Modern Roman, 'ptm' for Times-Roman, and 'phv' for Helvetica. The font series denotes the thickness of the glyphs, in most cases 'm' for normal ("medium") and 'bx' or 'b' for bold fonts. The font shape is 'n' for upright, 'it' for italics, 'sl' for slanted, or 'sc' for small caps, in general. Some fonts may provide different font series or shapes.
Examples:
Use Times-Roman boldface (with the same shape as in the surrounding text):
set terminal cairolatex font 'ptm,bx'
Use Helvetica, boldface, italics:
set terminal cairolatex font 'phv,bx,it'
Continue to use the surrounding font in slanted shape:
set terminal cairolatex font ',,sl'
Use small capitals:
set terminal cairolatex font ',,sc'
By this method, only text fonts are changed. If you also want to change the math fonts you have to use the "gnuplot.cfg" file or the header option, described below.
In standalone mode, the font size is taken from the given font size in the set terminal command. To be able to use a specified font size, a file "size<size>.clo" has to reside in the LaTeX search path. By default, 10pt, 11pt, and 12pt are supported. If the package "extsizes" is installed, 8pt, 9pt, 14pt, 17pt, and 20pt are added.
The header option takes a string as argument. This string is written into the generated LaTeX file. If using the standalone mode, it is written into the preamble, directly before the \begin{document} command. In the input mode, it is placed directly after the \begingroup command to ensure that all settings are local to the plot.
Examples:
Use T1 fontencoding, change the text and math font to Times-Roman as well as the sans-serif font to Helvetica:
set terminal cairolatex standalone header \ "\\usepackage[T1]{fontenc}\n\\usepackage{mathptmx}\n\\usepackage{helvet}"
Use a boldface font in the plot, not influencing the text outside the plot:
set terminal cairolatex input header "\\bfseries"
If the file "gnuplot.cfg" is found by LaTeX it is input in the preamble the LaTeX document, when using standalone mode. It can be used for further settings, e.g., changing the document font to Times-Roman, Helvetica, and Courier, including math fonts (handled by "mathptmx.sty"):
\usepackage{mathptmx} \usepackage[scaled=0.92]{helvet} \usepackage{courier}
The file "gnuplot.cfg" is loaded before the header information given by the header command. Thus, you can use header to overwrite some of settings performed using "gnuplot.cfg"
The canvas terminal creates a set of javascript commands that draw onto the HTML5 canvas element. Syntax:
set terminal canvas {size <xsize>, <ysize>} {background <rgb_color>} {font {<fontname>}{,<fontsize>}} | {fsize <fontsize>} {{no}enhanced} {linewidth <lw>} {rounded | butt | square} {dashlength <dl>} {standalone {mousing} | name '<funcname>'} {jsdir 'URL/for/javascripts'} {title '<some string>'}
where <xsize> and <ysize> set the size of the plot area in pixels. The default size in standalone mode is 600 by 400 pixels. The default font size is 10.
NB: Only one font is available, the ascii portion of Hershey simplex Roman provided in the file canvastext.js. You can replace this with the file canvasmath.js, which contains also UTF-8 encoded Hershey simplex Greek and math symbols. For consistency with other terminals, it is also possible to use font "name,size". Currently the font name is ignored, but browser support for named fonts is likely to arrive eventually.
The default standalone mode creates an html page containing javascript code that renders the plot using the HTML 5 canvas element. The html page links to two required javascript files 'canvastext.js' and 'gnuplot_common.js'. An additional file 'gnuplot_dashedlines.js' is needed to support dashed lines. By default these point to local files, on unix-like systems usually in directory /usr/local/share/gnuplot/<version>/js. See installation notes for other platforms. You can change this by using the jsdir option to specify either a different local directory or a general URL. The latter is usually appropriate if the plot is exported for viewing on remote client machines.
All plots produced by the canvas terminal are mouseable. The additional keyword mousing causes the standalone mode to add a mouse-tracking box underneath the plot. It also adds a link to a javascript file 'gnuplot_mouse.js' and to a stylesheet for the mouse box 'gnuplot_mouse.css' in the same local or URL directory as 'canvastext.js'.
The name option creates a file containing only javascript. Both the javascript function it contains and the id of the canvas element that it draws onto are taken from the following string parameter. The commands
set term canvas name 'fishplot' set output 'fishplot.js'
will create a file containing a javascript function fishplot() that will draw onto a canvas with id=fishplot. An html page that invokes this javascript function must also load the canvastext.js function as described above. A minimal html file to wrap the fishplot created above might be:
<html> <head> <script src="canvastext.js"></script> <script src="gnuplot_common.js"></script> </head> <body onload="fishplot();"> <script src="fishplot.js"></script> <canvas id="fishplot" width=600 height=400> <div id="err_msg">No support for HTML 5 canvas element</div> </canvas> </body> </html>
The individual plots drawn on this canvas will have names fishplot_plot_1, fishplot_plot_2, and so on. These can be referenced by external javascript routines, for example gnuplot.toggle_visibility("fishplot_plot_2").
The cgm terminal generates a Computer Graphics Metafile, Version 1. This file format is a subset of the ANSI X3.122-1986 standard entitled "Computer Graphics - Metafile for the Storage and Transfer of Picture Description Information".
Syntax:
set terminal cgm {color | monochrome} {solid | dashed} {{no}rotate} {<mode>} {width <plot_width>} {linewidth <line_width>} {font "<fontname>,<fontsize>"} {background <rgb_color>} recated] {<color0> <color1> <color2> ...}
solid draws all curves with solid lines, overriding any dashed patterns; <mode> is landscape, portrait, or default; <plot_width> is the assumed width of the plot in points; <line_width> is the line width in points (default 1); <fontname> is the name of a font (see list of fonts below) <fontsize> is the size of the font in points (default 12).
The first six options can be in any order. Selecting default sets all options to their default values.
The mechanism of setting line colors in the set term command is deprecated. Instead you should set the background using a separate keyword and set the line colors using set linetype. The deprecated mechanism accepted colors of the form 'xrrggbb', where x is the literal character 'x' and 'rrggbb' are the red, green and blue components in hex. The first color was used for the background, subsequent colors are assigned to successive line types.
Examples:
set terminal cgm landscape color rotate dashed width 432 \ linewidth 1 'Helvetica Bold' 12 # defaults set terminal cgm linewidth 2 14 # wider lines & larger font set terminal cgm portrait "Times Italic" 12 set terminal cgm color solid # no pesky dashes!
The first part of a Computer Graphics Metafile, the metafile description, includes a font table. In the picture body, a font is designated by an index into this table. By default, this terminal generates a table with the following 35 fonts, plus six more with italic replaced by oblique, or vice-versa (since at least the Microsoft Office and Corel Draw CGM import filters treat italic and oblique as equivalent):
The first thirteen of these fonts are required for WebCGM. The Microsoft Office CGM import filter implements the 13 standard fonts listed above, and also 'ZapfDingbats' and 'Script'. However, the script font may only be accessed under the name '15'. For more on Microsoft import filter font substitutions, check its help file which you may find here:
C:\Program Files\Microsoft Office\Office\Cgmimp32.hlp
and/or its configuration file, which you may find here:
C:\Program Files\Common Files\Microsoft Shared\Grphflt\Cgmimp32.cfg
In the set term command, you may specify a font name which does not appear in the default font table. In that case, a new font table is constructed with the specified font as its first entry. You must ensure that the spelling, capitalization, and spacing of the name are appropriate for the application that will read the CGM file. (Gnuplot and any MIL-D-28003A compliant application ignore case in font names.) If you need to add several new fonts, use several set term commands.
Example:
set terminal cgm 'Old English' set terminal cgm 'Tengwar' set terminal cgm 'Arabic' set output 'myfile.cgm' plot ... set output
You cannot introduce a new font in a set label command.
Fonts are scaled assuming the page is 6 inches wide. If the size command is used to change the aspect ratio of the page or the CGM file is converted to a different width, the resulting font sizes will be scaled up or down accordingly. To change the assumed width, use the width option.
The linewidth option sets the width of lines in pt. The default width is 1 pt. Scaling is affected by the actual width of the page, as discussed under the fontsize and width options.
The norotate option may be used to disable text rotation. For example, the CGM input filter for Word for Windows 6.0c can accept rotated text, but the DRAW editor within Word cannot. If you edit a graph (for example, to label a curve), all rotated text is restored to horizontal. The Y axis label will then extend beyond the clip boundary. With norotate, the Y axis label starts in a less attractive location, but the page can be edited without damage. The rotate option confirms the default behavior.
The solid option may be used to disable dashed line styles in the plots. This is useful when color is enabled and the dashing of the lines detracts from the appearance of the plot. The dashed option confirms the default behavior, which gives a different dash pattern to each line type.
Default size of a CGM plot is 32599 units wide and 23457 units high for landscape, or 23457 units wide by 32599 units high for portrait.
All distances in the CGM file are in abstract units. The application that reads the file determines the size of the final plot. By default, the width of the final plot is assumed to be 6 inches (15.24 cm). This distance is used to calculate the correct font size, and may be changed with the width option. The keyword should be followed by the width in points. (Here, a point is 1/72 inch, as in PostScript. This unit is known as a "big point" in TeX.) Gnuplot expressions can be used to convert from other units.
Example:
set terminal cgm width 432 # default set terminal cgm width 6*72 # same as above set terminal cgm width 10/2.54*72 # 10 cm wide
The default font table includes the fonts recommended for WebCGM, which are compatible with the Computer Graphics Metafile input filter for Microsoft Office and Corel Draw. Another application might use different fonts and/or different font names, which may not be documented. The nofontlist (synonym winword6) option deletes the font table from the CGM file. In this case, the reading application should use a default table. Gnuplot will still use its own default font table to select font indices. Thus, 'Helvetica' will give you an index of 1, which should get you the first entry in your application's default font table. 'Helvetica Bold' will give you its second entry, etc.
ConTeXt is a macro package for TeX, highly integrated with Metapost (for drawing figures) and intended for creation of high-quality PDF documents. The terminal outputs Metafun source, which can be edited manually, but you should be able to configure most things from outside.
For an average user of ConTeXt + gnuplot module it's recommended to refer to Using ConTeXt rather than reading this page or to read the manual of the gnuplot module for ConTeXt.
The context terminal supports the following options:
Syntax:
set term context {default} {defaultsize | size <scale> | size <xsize>{in|cm}, <ysize>{in|cm}} {input | standalone} {timestamp | notimestamp} {noheader | header "<header>"} {color | colour | monochrome} {rounded | mitered | beveled} {round | butt | squared} {dashed | solid} {dashlength | dl <dl>} {linewidth | lw <lw>} {fontscale <fontscale>} {mppoints | texpoints} {inlineimages | externalimages} {defaultfont | font "{<fontname>}{,<fontsize>}"}
In non-standalone (input) graphic only parameters size to select graphic size, fontscale to scale all the labels for a factor <fontscale> and font size, make sense, the rest is silently ignored and should be configured in the .tex file which inputs the graphic. It's highly recommended to set the proper fontsize if document font differs from 12pt, so that gnuplot will know how much space to reserve for labels.
default resets all the options to their default values.
defaultsize sets the plot size to 5in,3in. size <scale> sets the plot size to <scale> times <default value>. If two arguments are given (separated with ','), the first one sets the horizontal size and the second one the vertical size. Size may be given without units (in which case it means relative to the default value), with inches ('in') or centimeters ('cm').
input (default) creates a graphic that can be included into another ConTeXt document. standalone adds some lines, so that the document might be compiled as-is. You might also want to add header in that case.
Use header for any additional settings/definitions/macros that you might want to include in a standalone graphic. noheader is the default.
notimestamp prevents printing creation time in comments (if version control is used, one may prefer not to commit new version when only date changes).
color to make color plots is the default, but monochrome doesn't do anything special yet. If you have any good ideas how the behaviour should differ to suit the monochrome printers better, your suggestions are welcome.
rounded (default), mitered and beveled control the shape of line joins. round (default), butt and squared control the shape of line caps. See PostScript or PDF Reference Manual for explanation. For wild-behaving functions and thick lines it is better to use rounded and round to prevent sharp corners in line joins. (Some general support for this should be added to Gnuplot, so that the same options could be set for each line (style) separately).
dashed (default) uses different dash patterns for different line types, solid draws all plots with solid lines.
dashlength or dl scales the length of the dashed-line segments by <dl>. linewidth or lw scales all linewidths by <lw>. (lw 1 stands for 0.5bp, which is the default line width when drawing with Metapost.) fontscale scales text labels for factor <fontscale> relative to default document font.
mppoints uses predefined point shapes, drawn in Metapost. texpoints uses easily configurable set of symbols, defined with ConTeXt in the following way:
\defineconversion[my own points][+,{\ss x},\mathematics{\circ}] \setupGNUPLOTterminal[context][points=tex,pointset=my own points]
inlineimages writes binary images to a string and only works in ConTeXt MKIV. externalimages writes PNG files to disk and also works with ConTeXt MKII. Gnuplot needs to have support for PNG images built in for this to work.
With font you can set font name and size in standalone graphics. In non-standalone (input) mode only the font size is important to reserve enough space for text labels. The command
set term context font "myfont,ss,10"
will result in
\setupbodyfont[myfont,ss,10pt]
If you additionally set fontscale to 0.8 for example, then the resulting font will be 8pt big and
set label ... font "myfont,12"
will come out as 9.6pt.
It is your own responsibility to provide proper typescripts (and header), otherwise switching the font will have no effect. For a standard font in ConTeXt MKII (pdfTeX) you could use:
set terminal context standalone header '\usetypescript[iwona][ec]' \ font "iwona,ss,11"
Please take a look into ConTeXt documentation, wiki or mailing list (archives) for any up-to-date information about font usage.
Examples:
set terminal context size 10cm, 5cm # 10cm, 5cm set terminal context size 4in, 3in # 4in, 3in
For standalone (whole-page) plots with labels in UTF-8 encoding:
set terminal context standalone header '\enableregime[utf-8]'
You need gnuplot module for ConTeXt
http://ctan.org/pkg/context-gnuplot
and a recent version of ConTeXt. If you want to call gnuplot on-the-fly, you also need write18 enabled. In most TeX distributions this can be set with shell_escape=t in texmf.cnf.
See
http://wiki.contextgarden.net/Gnuplot
for details about this terminal and for more exhaustive help & examples.
The easiest way to make plots in ConTeXt documents is
\usemodule[gnuplot] \starttext \title{How to draw nice plots with {\sc gnuplot}?} \startGNUPLOTscript[sin] set format y "%.1f" plot sin(x) t '$\sin(x)$' \stopGNUPLOTscript \useGNUPLOTgraphic[sin] \stoptext
This will run gnuplot automatically and include the resulting figure in the document.
Legacy terminal for CorelDraw (circa 1995).
Syntax:
set terminal corel {monochrome | color} {"<font>" {<fontsize>}} {<xsize> <ysize> {<linewidth> }}
where the fontsize and linewidth are specified in points and the sizes in inches. The defaults are monochrome, "SwitzerlandLight", 22, 8.2, 10 and 1.2.
This terminal is provided to allow for the debugging of gnuplot. It is likely to be of use only for users who are modifying the source code.
The domterm terminal device runs on the DomTerm terminal emulator including the domterm and qtdomterm programs. It supports SVG graphics embedded directly in the terminal output. See http://domterm.org .
Please read the help for the svg terminal.
The dumb terminal driver plots into a text block using ascii characters. It has an optional size specification and a trailing linefeed flag.
Syntax:
set terminal dumb {size <xchars>,<ychars>} {[no]feed} {aspect <htic>{,<vtic>}} {[no]enhanced} {mono|ansi|ansi256|ansirgb}
where <xchars> and <ychars> set the size of the text block. The default is 79 by 24. The last newline is printed only if feed is enabled.
The aspect option can be used to control the aspect ratio of the plot by setting the length of the horizontal and vertical tic marks. Only integer values are allowed. Default is 2,1 -- corresponding to the aspect ratio of common screen fonts.
The ansi, ansi256, and ansirgb options will include escape sequences in the output to handle colors. Note that these might not be handled by your terminal. Default is mono. To obtain the best color match in ansi mode, you should use set colorsequence classic. Depending on the mode, the dumb terminal will emit the folowing sequences (without the additional whitespace):
ESC [ 0 m reset attributes to defaults foreground color: ESC [ 1 m set intense/bold ESC [ 22 m intense/bold off ESC [ <fg> m with color code 30 <= <fg> <= 37 ESC [ 39 m reset to default ESC [ 38; 5; <c> m with palette index 16 <= <c> <= 255 ESC [ 38; 2; <r>; <g>; <b> m with components 0 <= <r,g,b> <= 255 background color: ESC [ <bg> m with color code 40 <= <bg> <= 47 ESC [ 49 m reset to default ESC [ 48; 5; <c> m with palette index 16 <= <c> <= 231 ESC [ 48; 2; <r>; <g>; <b> m with components 0 <= <r,g,b> <= 255
See also e.g. the description at
https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
Example:
set term dumb mono size 60,15 aspect 1 set tics nomirror scale 0.5 plot [-5:6.5] sin(x) with impulse ls -1
1 +-------------------------------------------------+ 8 +|||++ ++||||++ | 6 +|||||+ ++|||||||+ sin(x) +----+ | 4 +||||||+ ++|||||||||+ | 2 +|||||||+ ++|||||||||||+ +| 0 ++++++++++++++++++++++++++++++++++++++++++++++++++| 2 + +|||||||||||+ +|||||||||||+ | 4 + +|||||||||+ +|||||||||+ | 6 + +|||||||+ +|||||||+ | 8 + ++||||+ ++||||+ | 1 +---+--------+--------+-------+--------+--------+-+ -4 -2 0 2 4 6
Terminal driver dxf for export to AutoCad (Release 10.x). It has no options. The default size is 120x80 AutoCad units. dxf uses seven colors (white, red, yellow, green, cyan, blue and magenta) that can be changed only by modifying the source file. If a black-and-white plotting device is used the colors are mapped to differing line thicknesses. Note: someone please update to use the 2012 DXF standard!
Note: legacy terminal. This terminal driver supports the Roland DXY800A plotter. It has no options.
The eepic terminal driver supports the extended LaTeX picture environment. It is an alternative to the latex driver.
The output of this terminal is intended for use with the "eepic.sty" macro package for LaTeX. To use it, you need "eepic.sty", "epic.sty" and a printer driver that supports the "tpic" \specials. If your printer driver doesn't support those \specials, "eepicemu.sty" will enable you to use some of them. dvips and dvipdfm do support the "tpic" \specials.
Syntax:
set terminal eepic {default} {color|dashed} {rotate} {size XX,YY} {small|tiny|<fontsize>}
Options: You can give options in any order you wish. 'color' causes gnuplot to produce \color{...} commands so that the graphs are colored. Using this option, you must include \usepackage{color} in the preamble of your latex document. 'dashed' will allow dashed line types; without this option, only solid lines with varying thickness will be used. 'dashed' and 'color' are mutually exclusive; if 'color' is specified, then 'dashed' will be ignored. 'rotate' will enable true rotated text (by 90 degrees). Otherwise, rotated text will be typeset with letters stacked above each other. If you use this option you must include \usepackage{graphicx} in the preamble. 'small' will use \scriptsize symbols as point markers (Probably does not work with TeX, only LaTeX2e). Default is to use the default math size. 'tiny' uses \scriptscriptstyle symbols. 'default' resets all options to their defaults = no color, no dashed lines, pseudo-rotated (stacked) text, large point symbols. <fontsize> is a number which specifies the font size inside the picture environment; the unit is pt (points), i.e., 10 pt equals approx. 3.5 mm. If fontsize is not specified, then all text inside the picture will be set in \footnotesize.
Notes: Remember to escape the # character (or other chars meaningful to (La-)TeX) by \\ (2 backslashes). It seems that dashed lines become solid lines when the vertices of a plot are too close. (I do not know if that is a general problem with the tpic specials, or if it is caused by a bug in eepic.sty or dvips/dvipdfm.) The default size of an eepic plot is 5x3 inches. You can change this using the size terminal option. Points, among other things, are drawn using the LaTeX commands "\Diamond", "\Box", etc. These commands no longer belong to the LaTeX2e core; they are included in the latexsym package, which is part of the base distribution and thus part of any LaTeX implementation. Please do not forget to use this package. Instead of latexsym, you can also include the amssymb package. All drivers for LaTeX offer a special way of controlling text positioning: If any text string begins with '{', you also need to include a '}' at the end of the text, and the whole text will be centered both horizontally and vertically. If the text string begins with '[', you need to follow this with a position specification (up to two out of t,b,l,r), ']{', the text itself, and finally '}'. The text itself may be anything LaTeX can typeset as an LR-box. '\rule{}{}'s may help for best positioning.
Examples: set term eepic
output graphs as eepic macros inside a picture environment; \input the resulting file in your LaTeX document.
set term eepic color tiny rotate 8
eepic macros with \color macros, \scripscriptsize point markers, true rotated text, and all text set with 8pt.
About label positioning: Use gnuplot defaults (mostly sensible, but sometimes not really best):
set title '\LaTeX\ -- $ \gamma $'
Force centering both horizontally and vertically:
set label '{\LaTeX\ -- $ \gamma $}' at 0,0
Specify own positioning (top here):
set xlabel '[t]{\LaTeX\ -- $ \gamma $}'
The other label -- account for long ticlabels:
set ylabel '[r]{\LaTeX\ -- $ \gamma $\rule{7mm}{0pt}}'
The emf terminal generates an Enhanced Metafile Format file. This file format is recognized by many Windows applications.
Syntax:
set terminal emf {color | monochrome} {enhanced {noproportional}} {rounded | butt} {linewidth <LW>} {dashlength <DL>} {size XX,YY} {background <rgb_color>} {font "<fontname>{,<fontsize>}"} {fontscale <scale>}
In monochrome mode successive line types cycle through dash patterns. linewidth <factor> multiplies all line widths by this factor. dashlength <factor> is useful for thick lines. <fontname> is the name of a font; and <fontsize> is the size of the font in points.
The nominal size of the output image defaults to 1024x768 in arbitrary units. You may specify a different nominal size using the size option.
Enhanced text mode tries to approximate proportional character spacing. If you are using a monospaced font, or don't like the approximation, you can turn off this correction using the noproportional option.
The default settings are color font "Arial,12" size 1024,768 Selecting default sets all options to their default values.
Examples:
set terminal emf 'Times Roman Italic, 12'
Note: legacy terminal. The emxvga and emxvesa terminal drivers support PCs with SVGA, VESA SVGA and VGA graphics boards, respectively. They are intended to be compiled with "emx-gcc" under either DOS or OS/2. They also need VESA and SVGAKIT maintained by Johannes Martin (JMARTIN@GOOFY.ZDV.UNI-MAINZ.DE) with additions by David J. Liu (liu@phri.nyu.edu).
Syntax:
set terminal emxvga set terminal emxvesa {vesa-mode}
The only option is the vesa mode for emxvesa, which defaults to G640x480x256.
The epscairo terminal device generates encapsulated PostScript (*.eps) using the cairo and pango support libraries. cairo version >= 1.6 is required.
Please read the help for the pdfcairo terminal.
The epslatex driver generates output for further processing by LaTeX.
Syntax:
set terminal epslatex {default} set terminal epslatex {standalone | input} {oldstyle | newstyle} {level1 | leveldefault | level3} {color | colour | monochrome} {background <rgbcolor> | nobackground} {dashlength | dl <DL>} {linewidth | lw <LW>} {pointscale | ps <PS>} {rounded | butt} {clip | noclip} {palfuncparam <samples>{,<maxdeviation>}} {size <XX>{unit},<YY>{unit}} {header <header> | noheader} {blacktext | colortext | colourtext} {{font} "fontname{,fontsize}" {<fontsize>}} {fontscale <scale>}
The epslatex terminal prints a plot as terminal postscript eps but transfers the texts to LaTeX instead of including in the PostScript code. Thus, many options are the same as in the postscript terminal.
The appearance of the epslatex terminal changed between versions 4.0 and 4.2 to reach better consistency with the postscript terminal: The plot size has been changed from 5 x 3 inches to 5 x 3.5 inches; the character width is now estimated to be 60% of the font size while the old epslatex terminal used 50%; now, the larger number of postscript linetypes and symbols are used. To reach an appearance that is nearly identical to the old one specify the option oldstyle. (In fact some small differences remain: the symbol sizes are slightly different, the tics are half as large as in the old terminal which can be changed using set tics scale, and the arrows have all features as in the postscript terminal.)
If you see the error message
"Can't find PostScript prologue file ... "
Please see and follow the instructions in postscript prologue.
The option color enables color, while monochrome prefers black and white drawing elements. Further, monochrome uses gray palette but it does not change color of objects specified with an explicit colorspec. dashlength or dl scales the length of dashed-line segments by <DL>, which is a floating-point number greater than zero. linewidth or lw scales all linewidths by <LW>.
By default the generated PostScript code uses language features that were introduced in PostScript Level 2, notably filters and pattern-fill of irregular objects such as filledcurves. PostScript Level 2 features are conditionally protected so that PostScript Level 1 interpreters do not issue errors but, rather, display a message or a PostScript Level 1 approximation. The level1 option substitutes PostScript Level 1 approximations of these features and uses no PostScript Level 2 code. This may be required by some old printers and old versions of Adobe Illustrator. The flag level1 can be toggled later by editing a single line in the PostScript output file to force PostScript Level 1 interpretation. In the case of files containing level 2 code, the above features will not appear or will be replaced by a note when this flag is set or when the interpreting program does not indicate that it understands level 2 PostScript or higher. The flag level3 enables PNG encoding for bitmapped images, which can reduce the output size considerably.
rounded sets line caps and line joins to be rounded; butt is the default, butt caps and mitered joins.
clip tells PostScript to clip all output to the bounding box; noclip is the default.
palfuncparam controls how set palette functions are encoded as gradients in the output. Analytic color component functions (set via set palette functions) are encoded as linear interpolated gradients in the postscript output: The color component functions are sampled at <samples> points and all points are removed from this gradient which can be removed without changing the resulting colors by more than <maxdeviation>. For almost every useful palette you may safely leave the defaults of <samples>=2000 and <maxdeviation>=0.003 untouched.
The default size for postscript output is 10 inches x 7 inches. The default for eps output is 5 x 3.5 inches. The size option changes this to whatever the user requests. By default the X and Y sizes are taken to be in inches, but other units are possibly (currently only cm). The BoundingBox of the plot is correctly adjusted to contain the resized image. Screen coordinates always run from 0.0 to 1.0 along the full length of the plot edges as specified by the size option. NB: this is a change from the previously recommended method of using the set size command prior to setting the terminal type. The old method left the BoundingBox unchanged and screen coordinates did not correspond to the actual limits of the plot.
blacktext forces all text to be written in black even in color mode;
The epslatex driver offers a special way of controlling text positioning: (a) If any text string begins with '{', you also need to include a '}' at the end of the text, and the whole text will be centered both horizontally and vertically by LaTeX. (b) If the text string begins with '[', you need to continue it with: a position specification (up to two out of t,b,l,r,c), ']{', the text itself, and finally, '}'. The text itself may be anything LaTeX can typeset as an LR-box. \rule{}{}'s may help for best positioning. See also the documentation for the pslatex terminal driver. To create multiline labels, use \shortstack, for example
set ylabel '[r]{\shortstack{first line \\ second line}}'
The back option of set label commands is handled slightly different than in other terminals. Labels using 'back' are printed behind all other elements of the plot while labels using 'front' are printed above everything else.
The driver produces two different files, one for the eps part of the figure and one for the LaTeX part. The name of the LaTeX file is taken from the set output command. The name of the eps file is derived by replacing the file extension (normally .tex) with .eps instead. There is no LaTeX output if no output file is given! Remember to close the output file before next plot unless in multiplot mode.
In your LaTeX documents use '\input{filename}' to include the figure. The .eps file is included by the command \includegraphics{...}, so you must also include \usepackage{graphicx} in the LaTeX preamble. If you want to use coloured text (option textcolour) you also have to include \usepackage{color} in the LaTeX preamble.
Pdf files can be made from the eps file using 'epstopdf'. If the graphics package is properly configured, the LaTeX files can also be processed by pdflatex without changes, using the pdf files instead of the eps files. The behaviour concerning font selection depends on the header mode. In all cases, the given font size is used for the calculation of proper spacing. When not using the standalone mode the actual LaTeX font and font size at the point of inclusion is taken, so use LaTeX commands for changing fonts. If you use e.g. 12pt as font size for your LaTeX document, use '"" 12' as options. The font name is ignored. If using standalone the given font and font size are used, see below for a detailed description.
If text is printed coloured is controlled by the TeX booleans \ifGPcolor and \ifGPblacktext. Only if \ifGPcolor is true and \ifGPblacktext is false, text is printed coloured. You may either change them in the generated TeX file or provide them globally in your TeX file, for example by using
\newif\ifGPblacktext \GPblacktexttrue
in the preamble of your document. The local assignment is only done if no global value is given.
When using the epslatex terminal give the name of the TeX file in the set output command including the file extension (normally ".tex"). The eps filename is generated by replacing the extension by ".eps".
If using the standalone mode a complete LaTeX header is added to the LaTeX file; and "-inc" is added to the filename of the eps file. The standalone mode generates a TeX file that produces output with the correct size when using dvips, pdfTeX, or VTeX. The default, input, generates a file that has to be included into a LaTeX document using the \input command.
If a font other than "" or "default" is given it is interpreted as LaTeX font name. It contains up to three parts, separated by a comma: 'fontname,fontseries,fontshape'. If the default fontshape or fontseries are requested, they can be omitted. Thus, the real syntax for the fontname is '[fontname][,fontseries][,fontshape]'. The naming convention for all parts is given by the LaTeX font scheme. The fontname is 3 to 4 characters long and is built as follows: One character for the font vendor, two characters for the name of the font, and optionally one additional character for special fonts, e.g., 'j' for fonts with old-style numerals or 'x' for expert fonts. The names of many fonts is described in
http://www.tug.org/fontname/fontname.pdf
For example, 'cmr' stands for Computer Modern Roman, 'ptm' for Times-Roman, and 'phv' for Helvetica. The font series denotes the thickness of the glyphs, in most cases 'm' for normal ("medium") and 'bx' or 'b' for bold fonts. The font shape is 'n' for upright, 'it' for italics, 'sl' for slanted, or 'sc' for small caps, in general. Some fonts may provide different font series or shapes.
Examples:
Use Times-Roman boldface (with the same shape as in the surrounding text):
set terminal epslatex 'ptm,bx'
Use Helvetica, boldface, italics:
set terminal epslatex 'phv,bx,it'
Continue to use the surrounding font in slanted shape:
set terminal epslatex ',,sl'
Use small capitals:
set terminal epslatex ',,sc'
By this method, only text fonts are changed. If you also want to change the math fonts you have to use the "gnuplot.cfg" file or the header option, described below.
In standalone mode, the font size is taken from the given font size in the set terminal command. To be able to use a specified font size, a file "size<size>.clo" has to reside in the LaTeX search path. By default, 10pt, 11pt, and 12pt are supported. If the package "extsizes" is installed, 8pt, 9pt, 14pt, 17pt, and 20pt are added.
The header option takes a string as argument. This string is written into the generated LaTeX file. If using the standalone mode, it is written into the preamble, directly before the \begin{document} command. In the input mode, it is placed directly after the \begingroup command to ensure that all settings are local to the plot.
Examples:
Use T1 fontencoding, change the text and math font to Times-Roman as well as the sans-serif font to Helvetica:
set terminal epslatex standalone header \ "\\usepackage[T1]{fontenc}\n\\usepackage{mathptmx}\n\\usepackage{helvet}"
Use a boldface font in the plot, not influencing the text outside the plot:
set terminal epslatex input header "\\bfseries"
If the file "gnuplot.cfg" is found by LaTeX it is input in the preamble the LaTeX document, when using standalone mode. It can be used for further settings, e.g., changing the document font to Times-Roman, Helvetica, and Courier, including math fonts (handled by "mathptmx.sty"):
\usepackage{mathptmx} \usepackage[scaled=0.92]{helvet} \usepackage{courier}
The file "gnuplot.cfg" is loaded before the header information given by the header command. Thus, you can use header to overwrite some of settings performed using "gnuplot.cfg"
Note: only available if gnuplot is configured --with-bitmap-terminals. This driver supports a family of Epson printers and derivatives.
epson_180dpi and epson_60dpi are drivers for Epson LQ-style 24-pin printers with resolutions of 180 and 60 dots per inch, respectively.
epson_lx800 is a generic 9-pin driver appropriate for printers like the Epson LX-800, the Star NL-10 and NX-1000, the PROPRINTER, and so forth.
nec_cp6 is generic 24-pin driver that can be used for printers like the NEC CP6 and the Epson LQ-800.
The okidata driver supports the 9-pin OKIDATA 320/321 Standard printers.
The starc driver is for the Star Color Printer.
The tandy_60dpi driver is for the Tandy DMP-130 series of 9-pin, 60-dpi printers.
The dpu414 driver is for the Seiko DPU-414 thermal printer.
nec_cp6 has the options:
Syntax:
set terminal nec_cp6 {monochrome | colour | draft}
which defaults to monochrome.
dpu414 has the options:
Syntax:
set terminal dpu414 {small | medium | large} {normal | draft}
which defaults to medium (=font size) and normal. Preferred combinations are medium normal and small draft.
Note: legacy terminal. The excl terminal driver supports Talaris printers such as the EXCL Laser printer and the 1590. It has no options.
The fig terminal device generates output in the Fig graphics language for import into the xfig interactive drawing tool. Notes:
The fig terminal was significantly revised in gnuplot 5.2.7. Currently only version 3.2 of the fig file format is supported. Use of dash patterns may require Xfig 3.2.6 or newer.
Syntax:
set terminal fig {monochrome | color} {small | big | size <xsize>{in|cm},<ysize>{in|cm}} {landscape | portrait} {font "<fontname>{,<fontsize>}"} {fontsize <size>} {textnormal | {textspecial texthidden textrigid}} {{linewidth|lw} <multiplier>}
The default settings are
set term fig color small landscape font "Times Roman,10" lw 1.0
size sets the size of the drawing area to <xsize>*<ysize> in units of inches (default) or centimeters. The default is size 5in,3in. small is shorthand for size 5in,3in (3in,5in in portrait mode). big is shorthand for size 8in,5in.
font sets the text font face to <fontname> and its size to <fontsize> points. Choice is limited to the 35 standard PostScript fonts. textnormal resets the text flags and selects postscript fonts, textspecial sets the text flags for LaTeX specials, texthidden sets the hidden flag and textrigid the rigid flag.
linewidth is a multiplier for the linewidth property of all lines.
Additional point-plot symbols are also available in the fig driver. The symbols can be used through pointtype values % 100 above 50, with different fill intensities controlled by <pointtype> % 5 and outlines in black (for <pointtype> % 10 < 5) or in the current color. Available symbols are
50 - 59: circles 60 - 69: squares 70 - 79: diamonds 80 - 89: upwards triangles 90 - 99: downwards triangles
The size of these symbols scales with the font size.
RGB colors will be replaced with gray unless they have been defined in a linetype prior to plotting or match a known named color or palette value. See colornames. E.g.
set linetype 999 lc rgb '#aabbcc' plot $data with fillecurve fillcolor rgb '#aabbcc'
Legacy terminal driver for the GGI (General Graphics Interface) project. Syntax:
set terminal ggi [acceleration <integer>] [[mode] {mode}]
In X the window cannot be resized using window manager handles, but the mode can be given with the mode option, e.g.:
Please refer to the ggi documentation for other modes. The 'mode' keyword is optional. It is recommended to select the target by environment variables as explained in the libggi manual page. To get DGA on X, you should for example
bash> export GGI_DISPLAY=DGA csh> setenv GGI_DISPLAY DGA
'acceleration' is only used for targets which report relative pointer motion events (e.g. DGA) and is a strictly positive integer multiplication factor for the relative distances. The default for acceleration is 7.
Examples:
set term ggi acc 10 set term ggi acc 1 mode V1024x768 set term ggi V1024x768
Syntax:
set terminal gif {{no}enhanced} {{no}transparent} {rounded|butt} {linewidth <lw>} {dashlength <dl>} {tiny | small | medium | large | giant} {font "<face> {,<pointsize>}"} {fontscale <scale>} {size <x>,<y>} {{no}crop} {animate {delay <d>} {loop <n>} {{no}optimize}} {background <rgb_color>}
PNG, JPEG and GIF images are created using the external library libgd. GIF plots may be viewed interactively by piping the output to the 'display' program from the ImageMagick package as follows:
set term gif set output '| display gif:-'
You can view the output from successive plot commands interactively by typing <space> in the display window. To save the current plot to a file, left click in the display window and choose save.
transparent instructs the driver to make the background color transparent. Default is notransparent.
The linewidth and dashlength options are scaling factors that affect all lines drawn, i.e. they are multiplied by values requested in various drawing commands.
butt instructs the driver to use a line drawing method that does not overshoot the desired end point of a line. This setting is only applicable for line widths greater than 1. This setting is most useful when drawing horizontal or vertical lines. Default is rounded.
The details of font selection are complicated. Two equivalent simple examples are given below:
set term gif font arial 11 set term gif font "arial,11"
For more information please see the separate section under fonts.
The animate option is available only if your local gd library supports the creation of animated gifs. The default delay between display of successive images may be specified in units of 1/100 second (default 5). The actual delay may vary depending on the program used as a viewer. Number of animation loops can be specified, default 0 means infinity. An animation sequence is terminated by the next set output or set term command. The optimize option has two effects on the animation.
1) A single color map is used for the entire animation. This requires that all colors used in any frame of the animation are already defined in the first frame.
2) If possible, only the portions of a frame that differ from the previous frame are stored in the animation file. This space saving may not be possible if the animation uses transparency.
Both of these optimizations are intended to produce a smaller output file, but the decrease in size is probably only significant for long animations or very small frame sizes. The nooptimize option turns off both of the effects just described. Each frame is stored in its entirety along with a private color map. Note that it is possible to post-process a non-optimized animation using external utilities, and this post-processing can yield a smaller file than gnuplot's internal optimization mode. The default is nooptimize.
The output plot size <x,y> is given in pixels---it defaults to 640x480. Please see additional information under canvas and set size. Blank space at the edges of the finished plot may be trimmed using the crop option, resulting in a smaller final image size. Default is nocrop.
set terminal gif medium size 640,480 background '#ffffff'
Use the medium size built-in non-scaleable, non-rotatable font. Use white (24 bit RGB in hexadecimal) for the non-transparent background.
set terminal gif font arial 14 enhanced
Searches for a scalable font with face name 'arial' and sets the font size to 14pt. Please see fonts for details of how the font search is done. Because this is a scalable font, we can use enhanced text mode.
set term gif animate transparent opt delay 10 size 200,200 load "animate2.dem"
Open the gif terminal for creation of an animated gif file. The individual frames of the animation sequence are created by the script file animate2.dem from the standard collection of demos.
The gpic terminal driver generates GPIC graphs in the Free Software Foundations's "groff" package. The default size is 5 x 3 inches. The only option is the origin, which defaults to (0,0).
Syntax:
set terminal gpic {<x> <y>}
where x and y are in inches.
A simple graph can be formatted using
groff -p -mpic -Tps file.pic > file.ps.
The output from pic can be pipe-lined into eqn, so it is possible to put complex functions in a graph with the set label and set {x/y}label commands. For instance,
set ylab '@space 0 int from 0 to x alpha ( t ) roman d t@'
will label the y axis with a nice integral if formatted with the command:
gpic filename.pic | geqn -d@@ -Tps | groff -m[macro-package] -Tps > filename.ps
Figures made this way can be scaled to fit into a document. The pic language is easy to understand, so the graphs can be edited by hand if need be. All co-ordinates in the pic-file produced by gnuplot are given as x+gnuplotx and y+gnuploty. By default x and y are given the value 0. If this line is removed with an editor in a number of files, one can put several graphs in one figure like this (default size is 5.0x3.0 inches):
.PS 8.0 x=0;y=3 copy "figa.pic" x=5;y=3 copy "figb.pic" x=0;y=0 copy "figc.pic" x=5;y=0 copy "figd.pic" .PE
This will produce an 8-inch-wide figure with four graphs in two rows on top of each other.
One can also achieve the same thing by specifying x and y in the command
set terminal gpic x y
Note: legacy terminal. The grass terminal driver gives gnuplot capabilities to users of the GRASS geographic information system. Contact grassp-list@moon.cecer.army.mil for more information. Pages are written to the current frame of the GRASS Graphics Window. There are no options.
The hp2623a terminal driver supports the Hewlett Packard HP2623A. It has no options.
The hp2648 terminal driver supports the Hewlett Packard HP2647 and HP2648. It has no options.
Note: only available if gnuplot is configured --with-bitmap-terminals. The hp500c terminal driver supports the Hewlett Packard HP DeskJet 500c. It has options for resolution and compression.
Syntax:
set terminal hp500c {<res>} {<comp>}
where res can be 75, 100, 150 or 300 dots per inch and comp can be "rle", or "tiff". Any other inputs are replaced by the defaults, which are 75 dpi and no compression. Rasterization at the higher resolutions may require a large amount of memory.
The hpgl driver produces HPGL output for devices like the HP7475A plotter. There are two options which can be set: the number of pens and eject, which tells the plotter to eject a page when done. The default is to use 6 pens and not to eject the page when done.
The international character sets ISO-8859-1 and CP850 are recognized via set encoding iso_8859_1 or set encoding cp850 (see set encoding for details).
Syntax:
set terminal hpgl {<number_of_pens>} {eject}
The selection
set terminal hpgl 8 eject
is equivalent to the previous hp7550 terminal, and the selection
set terminal hpgl 4
is equivalent to the previous hp7580b terminal.
The pcl5 driver supports plotters such as the Hewlett-Packard Designjet 750C, the Hewlett-Packard Laserjet III, and the Hewlett-Packard Laserjet IV. It actually uses HPGL-2, but there is a name conflict among the terminal devices. It has several options which must be specified in the order indicated below:
Syntax:
set terminal pcl5 {mode <mode>} {<plotsize>} {{color {<number_of_pens>}} | monochrome} {solid | dashed} {font <font>} {size <fontsize>} {pspoints | nopspoints}
<mode> is landscape or portrait. <plotsize> is the physical plotting size of the plot, which is one of the following: letter for standard (8 1/2" X 11") displays, legal for (8 1/2" X 14") displays, noextended for (36" X 48") displays (a letter size ratio) or, extended for (36" X 55") displays (almost a legal size ratio). color is for multi-pen (i.e. color) plots, and <number_of_pens> is the number of pens (i.e. colors) used in color plots. monochrome is for one (e.g. black) pen plots. solid draws all lines as solid lines, or dashed will draw lines with different dashed and dotted line patterns. <font> is stick, univers, cg_times, zapf_dingbats, antique_olive, arial, courier, garamond_antigua, letter_gothic, cg_omega, albertus, times_new_roman, clarendon, coronet, marigold, truetype_symbols, or wingdings. <fontsize> is the font size in points. The point type selection can be the standard default set by specifying nopspoints, or the same set of point types found in the postscript terminal by specifying pspoints.
Note that built-in support of some of these options is printer device dependent. For instance, all the fonts are supposedly supported by the HP Laserjet IV, but only a few (e.g. univers, stick) may be supported by the HP Laserjet III and the Designjet 750C. Also, color obviously won't work on the the laserjets since they are monochrome devices.
Defaults: landscape, noextended, color (6 pens), solid, univers, 12 point,
and nopspoints.
With pcl5 international characters are handled by the printer; you just put the appropriate 8-bit character codes into the text strings. You don't need to bother with set encoding.
HPGL graphics can be imported by many software packages.
Note: only available if gnuplot is configured --with-bitmap-terminals. The hpljii terminal driver supports the HP Laserjet Series II printer. The hpdj driver supports the HP DeskJet 500 printer. These drivers allow a choice of resolutions.
Syntax:
set terminal hpljii | hpdj {<res>}
where res may be 75, 100, 150 or 300 dots per inch; the default is 75. Rasterization at the higher resolutions may require a large amount of memory.
The hp500c terminal is similar to hpdj; hp500c additionally supports color and compression.
Note: only available if gnuplot is configured --with-bitmap-terminals. The hppj terminal driver supports the HP PaintJet and HP3630 printers. The only option is the choice of font.
Syntax:
set terminal hppj {FNT5X9 | FNT9X17 | FNT13X25}
with the middle-sized font (FNT9X17) being the default.
The imagen terminal driver supports Imagen laser printers. It is capable of placing multiple graphs on a single page.
Syntax:
set terminal imagen {<fontsize>} {portrait | landscape} {[<horiz>,<vert>]}
where fontsize defaults to 12 points and the layout defaults to landscape. <horiz> and <vert> are the number of graphs in the horizontal and vertical directions; these default to unity.
Example:
set terminal imagen portrait [2,3]
puts six graphs on the page in three rows of two in portrait orientation.
Syntax:
set terminal jpeg {{no}enhanced} {{no}interlace} {linewidth <lw>} {dashlength <dl>} {rounded|butt} {tiny | small | medium | large | giant} {font "<face> {,<pointsize>}"} {fontscale <scale>} {size <x>,<y>} {{no}crop} {background <rgb_color>}
PNG, JPEG and GIF images are created using the external library libgd. In most cases, PNG is to be preferred for single plots, and GIF for animations. Both are loss-less image formats, and produce better image quality than the lossy JPEG format. This is in particular noticeable for solid color lines against a solid background, i.e. exactly the sort of image typically created by gnuplot.
The interlace option creates a progressive JPEG image. Default is nointerlace.
The linewidth and dashlength options are scaling factors that affect all lines drawn, i.e. they are multiplied by values requested in various drawing commands.
butt instructs the driver to use a line drawing method that does not overshoot the desired end point of a line. This setting is only applicable for line widths greater than 1. This setting is most useful when drawing horizontal or vertical lines. Default is rounded.
The details of font selection are complicated. Two equivalent simple examples are given below:
set term jpeg font arial 11 set term jpeg font "arial,11"
For more information please see the separate section under fonts.
The output plot size <x,y> is given in pixels---it defaults to 640x480. Please see additional information under canvas and set size. Blank space at the edges of the finished plot may be trimmed using the crop option, resulting in a smaller final image size. Default is nocrop.
The kyo and prescribe terminal drivers support the Kyocera laser printer. The only difference between the two is that kyo uses "Helvetica" whereas prescribe uses "Courier". There are no options.
Syntax:
set terminal {latex | emtex} {default | {courier|roman} {<fontsize>}} {size <XX>{unit}, <YY>{unit}} {rotate | norotate}
By default the plot will inherit font settings from the embedding document. You have the option of forcing either Courier (cmtt) or Roman (cmr) fonts instead. In this case you may also specify a fontsize. Unless your driver is capable of building fonts at any size (e.g. dvips), stick to the standard 10, 11 and 12 point sizes.
METAFONT users beware: METAFONT does not like odd sizes.
All drivers for LaTeX offer a special way of controlling text positioning: If any text string begins with '{', you also need to include a '}' at the end of the text, and the whole text will be centered both horizontally and vertically. If the text string begins with '[', you need to follow this with a position specification (up to two out of t,b,l,r), ']{', the text itself, and finally '}'. The text itself may be anything LaTeX can typeset as an LR-box. '\rule{}{}'s may help for best positioning.
Points, among other things, are drawn using the LaTeX commands "\Diamond" and "\Box". These commands no longer belong to the LaTeX2e core; they are included in the latexsym package, which is part of the base distribution and thus part of any LaTeX implementation. Please do not forget to use this package. Other point types use symbols from the amssymb package.
The default size for the plot is 5 inches by 3 inches. The size option changes this to whatever the user requests. By default the X and Y sizes are taken to be in inches, but other units are possible (currently only cm).
If 'rotate' is specified, rotated text, especially a rotated y-axis label, is possible (the packages graphics or graphicx are needed). The 'stacked' y-axis label mechanism is then deactivated.
Examples: About label positioning: Use gnuplot defaults (mostly sensible, but sometimes not really best):
set title '\LaTeX\ -- $ \gamma $'
Force centering both horizontally and vertically:
set label '{\LaTeX\ -- $ \gamma $}' at 0,0
Specify own positioning (top here):
set xlabel '[t]{\LaTeX\ -- $ \gamma $}'
The other label -- account for long ticlabels:
set ylabel '[r]{\LaTeX\ -- $ \gamma $\rule{7mm}{0pt}}'
DEPRECATED (will be removed in next gnuplot release). The linux driver has no additional options to specify. It looks at the environment variable GSVGAMODE for the default mode; if not set, it uses 1024x768x256 as default mode or, if that is not possible, 640x480x16 (standard VGA).
The lua generic terminal driver works in conjunction with an external Lua script to create a target-specific plot file. Currently the only supported target is TikZ -> pdflatex.
Information about Lua is available at http://www.lua.org .
Syntax:
set terminal lua <target name> | "<file name>" {<script_args> ...} {help}
A 'target name' or 'file name' (in quotes) for a script is mandatory. If a 'target name' for the script is given, the terminal will look for "gnuplot-<target name>.lua" in the local directory and on failure in the environmental variable GNUPLOT_LUA_DIR.
All arguments will be provided to the selected script for further evaluation. E.g. 'set term lua tikz help' will cause the script itself to print additional help on options and choices for the script.
The TikZ driver is one output mode of the generic Lua terminal.
Syntax:
set terminal lua tikz
{latex | tex | context} {color | monochrome} {nooriginreset | originreset} {nogparrows | gparrows} {nogppoints | gppoints} {picenvironment | nopicenvironment} {noclip | clip} {notightboundingbox | tightboundingbox} {background "<colorpec>"} {size <x>{unit},<y>{unit}} {scale <x>,<y>} {plotsize <x>{unit},<y>{unit}} {charsize <x>{unit},<y>{unit}} {font "<fontdesc>"} {{fontscale | textscale} <scale>} {dashlength | dl <DL>} {linewidth | lw <LW>} {nofulldoc | nostandalone | fulldoc | standalone} {{preamble | header} "<preamble_string>"} {tikzplot <ltn>,...} {notikzarrows | tikzarrows} {rgbimages | cmykimages} {noexternalimages|externalimages} {bitmap | nobitmap} {providevars <var name>,...} {createstyle} {help}
For all options that expect lengths as their arguments they will default to 'cm' if no unit is specified. For all lengths the following units may be used: 'cm', 'mm', 'in' or 'inch', 'pt', 'pc', 'bp', 'dd', 'cc'. Blanks between numbers and units are not allowed.
'monochrome' disables line coloring and switches to grayscaled fills.
'originreset' moves the origin of the TikZ picture to the lower left corner of the plot. It may be used to align several plots within one tikzpicture environment. This is not tested with multiplots and pm3d plots!
'gparrows' use gnuplot's internal arrow drawing function instead of the ones provided by TikZ.
'gppoints' use gnuplot's internal plotmark drawing function instead of the ones provided by TikZ.
'nopicenvironment' omits the declaration of the 'tikzpicture' environment in order to set it manually. This permits putting some PGF/TikZ code directly before or after the plot.
'clip' crops the plot at the defined canvas size. Default is 'noclip' by which only a minimum bounding box of the canvas size is set. Neither a fixed bounding box nor a crop box is set if the 'plotsize' or 'tightboundingbox' option is used.
If 'tightboundingbox' is set the 'clip' option is ignored and the final bounding box is the natural bounding box calculated by tikz.
'background' sets the background color to the value specified in the <colorpec> argument. <colorspec> must be a valid color name or a 3 byte RGB code as a hexadecimal number with a preceding number sign ('#'). E.g. '#ff0000' specifies pure red. If omitted the background is transparent.
The 'size' option expects two lenghts <x> and <y> as the canvas size. The default size of the canvas is 12.5cm x 8.75cm.
The 'scale' option works similar to the 'size' option but expects scaling factors <x> and <y> instead of lengths.
The 'plotsize' option permits setting the size of the plot area instead of the canvas size, which is the usual gnuplot behaviour. Using this option may lead to slightly asymmetric tic lengths. Like 'originreset' this option may not lead to convenient results if used with multiplots or pm3d plots. An alternative approach is to set all margins to zero and to use the 'noclip' option. The plot area has then the dimensions of the given canvas sizes.
The 'charsize' option expects the average horizontal and vertical size of the used font. Look at the generated style file for an example of how to use it from within your TeX document.
'fontscale' or 'textscale' expects a scaling factor as a parameter. All texts in the plot are scaled by this factor then.
'dashlength' or 'dl' scales the length of dashed-line segments by <DL>, which is a floating-point number greater than zero. 'linewidth' or 'lw' scales all linewidths by <LW>.
The options 'tex', 'latex' and 'context' choose the TeX output format. LaTeX is the default. To load the style file put the according line at the beginning of your document:
\input gnuplot-lua-tikz.tex % (for plain TeX) \usepackage{gnuplot-lua-tikz} % (for LaTeX) \usemodule[gnuplot-lua-tikz] % (for ConTeXt)
'createstyle' derives the TeX/LaTeX/ConTeXt styles from the script and writes them to the appropriate files.
'fulldoc' or 'standalone' produces a full LaTeX document for direct compilation.
'preamble' or 'header' may be used to put any additional LaTeX code into the document preamble in standalone mode.
With the 'tikzplot' option the '\path plot' command will be used instead of only '\path'. The following list of numbers of linetypes (<ltn>,...) defines the affected plotlines. There exists a plotstyle for every linetype. The default plotstyle is 'smooth' for every linetype >= 1.
By default the tikz terminal produces simple LaTeX arrows. To produce arrows in accord with gnuplot's 'arrowstyle' settings, use the 'gparrows' option. The 'tikzarrows' option is a third alternative that bypasses both of these. Instead the arrowstyle 'angle' parameter is used to index a set of 12 pre-defined TikZ arrow styles. E.g. an arrow style with the angle '7' will be mapped to the TikZ style 'gp arrow 7' ignoring all other arrowstyle settings.
With 'cmykimages' the CMYK color model will be used for inline image data instead of the RGB model. All other colors (like line colors etc.) are not affected by this option, since they are handled e.g. by LaTeX's xcolor package. This option is ignored if images are externalized.
By using the 'externalimages' option all bitmap images will be written as external PNG images and included at compile time of the document. Generating DVI and later postscript files requires to convert the PNGs into EPS files in a seperate step e.g. by using ImageMagick's convert. Transparent bitmap images are always generated as an external PNGs.
The 'nobitmap' option let images be rendered as filled rectangles instead of the nativ PS or PDF inline image format. This option is ignored if images are externalized.
The 'providevars' options makes gnuplot's internal and user variables available by using the '\gpgetvar{<var name>}' commmand within the TeX script. Use gnuplot's 'show variables all' command to see the list of valid variables.
The <fontdesc> string may contain any valid TeX/LaTeX/ConTeXt font commands like e.g. '\small'. It is passed directly as a node parameter in form of "font={<fontdesc>}". This can be 'misused' to add further code to a node, e.g. '\small,yshift=1ex' or ',yshift=1ex' are also valid while the latter does not change the current font settings. One exception is the second argument of the list. If it is a number of the form <number>{unit} it will be interpreted as a fontsize like in other terminals and will be appended to the first argument. If the unit is omitted the value is interpreted as 'pt'. As an example the string '\sffamily,12,fill=red' sets the font to LaTeX's sans serif font at a size of 12pt and red background color. The same applies to ConTeXt, e.g. '\switchtobodyfont[iwona],10' changes the font to Iwona at a size of 10pt. Plain TeX users have to change the font size explicitly within the first argument. The second should be set to the same value to get proper scaling of text boxes.
Strings have to be put in single or double quotes. Double quoted strings may contain special characters like newlines '\n' etc.
The mf terminal driver creates an input file to the METAFONT program. Thus a figure may be used in the TeX document in the same way as is a character.
To use a picture in a document, the METAFONT program must be run with the output file from gnuplot as input. Thus, the user needs a basic knowledge of the font creating process and the procedure for including a new font in a document. However, if the METAFONT program is set up properly at the local site, an unexperienced user could perform the operation without much trouble.
The text support is based on a METAFONT character set. Currently the Computer Modern Roman font set is input, but the user is in principal free to choose whatever fonts he or she needs. The METAFONT source files for the chosen font must be available. Each character is stored in a separate picture variable in METAFONT. These variables may be manipulated (rotated, scaled etc.) when characters are needed. The drawback is the interpretation time in the METAFONT program. On some machines (i.e. PC) the limited amount of memory available may also cause problems if too many pictures are stored.
The mf terminal has no options.
- Set your terminal to METAFONT:
set terminal mf
- Select an output-file, e.g.:
set output "myfigures.mf"
- Create your pictures. Each picture will generate a separate character. Its default size will be 5*3 inches. You can change the size by saying set size 0.5,0.5 or whatever fraction of the default size you want to have.
- Quit gnuplot.
- Generate a TFM and GF file by running METAFONT on the output of gnuplot. Since the picture is quite large (5*3 in), you will have to use a version of METAFONT that has a value of at least 150000 for memmax. On Unix systems these are conventionally installed under the name bigmf. For the following assume that the command virmf stands for a big version of METAFONT. For example:
- Invoke METAFONT:
virmf '&plain'
- Select the output device: At the METAFONT prompt ('*') type:
\mode:=CanonCX; % or whatever printer you use
- Optionally select a magnification:
mag:=1; % or whatever you wish
- Input the gnuplot-file:
input myfigures.mf
On a typical Unix machine there will usually be a script called "mf" that executes virmf '&plain', so you probably can substitute mf for virmf &plain. This will generate two files: mfput.tfm and mfput.$$$gf (where $$$ indicates the resolution of your device). The above can be conveniently achieved by typing everything on the command line, e.g.: virmf '&plain' '\mode:=CanonCX; mag:=1; input myfigures.mf' In this case the output files will be named myfigures.tfm and myfigures.300gf.
- Generate a PK file from the GF file using gftopk:
gftopk myfigures.300gf myfigures.300pk
The name of the output file for gftopk depends on the DVI driver you use. Ask your local TeX administrator about the naming conventions. Next, either install the TFM and PK files in the appropriate directories, or set your environment variables properly. Usually this involves setting TEXFONTS to include the current directory and doing the same thing for the environment variable that your DVI driver uses (no standard name here...). This step is necessary so that TeX will find the font metric file and your DVI driver will find the PK file.
- To include your pictures in your document you have to tell TeX the font:
\font\gnufigs=myfigures
Each picture you made is stored in a single character. The first picture is character 0, the second is character 1, and so on... After doing the above step, you can use the pictures just like any other characters. Therefore, to place pictures 1 and 2 centered in your document, all you have to do is:
\centerline{\gnufigs\char0} \centerline{\gnufigs\char1}
in plain TeX. For LaTeX you can, of course, use the picture environment and place the picture wherever you wish by using the \makebox and \put macros.
This conversion saves you a lot of time once you have generated the font; TeX handles the pictures as characters and uses minimal time to place them, and the documents you make change more often than the pictures do. It also saves a lot of TeX memory. One last advantage of using the METAFONT driver is that the DVI file really remains device independent, because no \special commands are used as in the eepic and tpic drivers.
Note: Legacy terminal. The mif terminal driver produces Frame Maker MIF format version 3.00. It plots in MIF Frames with the size 15*10 cm, and plot primitives with the same pen will be grouped in the same MIF group. Plot primitives in a gnuplot page will be plotted in a MIF Frame, and several MIF Frames are collected in one large MIF Frame. The MIF font used for text is "Times".
Several options may be set in the MIF 3.00 driver.
Syntax:
set terminal mif {color | colour | monochrome} {polyline | vectors} {help | ?}
colour plots lines with line types >= 0 in colour (MIF sep. 2--7) and monochrome plots all line types in black (MIF sep. 0). polyline plots curves as continuous curves and vectors plots curves as collections of vectors. help and ? print online help on standard error output---both print a short description of the usage; help also lists the options.
Examples:
set term mif colour polylines # defaults set term mif # defaults set term mif vectors set term mif help
The mp driver produces output intended to be input to the Metapost program. Running Metapost on the file creates EPS files containing the plots. By default, Metapost passes all text through TeX. This has the advantage of allowing essentially any TeX symbols in titles and labels.
Syntax:
set term mp {color | colour | monochrome} {solid | dashed} {notex | tex | latex} {magnification <magsize>} {psnfss | psnfss-version7 | nopsnfss} {prologues <value>} {a4paper} {amstex} {"<fontname> {,<fontsize>}"}
The option color causes lines to be drawn in color (on a printer or display that supports it), monochrome (or nothing) selects black lines. The option solid draws solid lines, while dashed (or nothing) selects lines with different patterns of dashes. If solid is selected but color is not, nearly all lines will be identical. This may occasionally be useful, so it is allowed.
The option notex bypasses TeX entirely, therefore no TeX code can be used in labels under this option. This is intended for use on old plot files or files that make frequent use of common characters like $ and % that require special handling in TeX.
The option tex sets the terminal to output its text for TeX to process.
The option latex sets the terminal to output its text for processing by LaTeX. This allows things like \frac for fractions which LaTeX knows about but TeX does not. Note that you must set the environment variable TEX to the name of your LaTeX executable (normally latex) if you use this option or use mpost --tex=<name of LaTeX executable> .... Otherwise metapost will try and use TeX to process the text and it won't work.
Changing font sizes in TeX has no effect on the size of mathematics, and there is no foolproof way to make such a change, except by globally setting a magnification factor. This is the purpose of the magnification option. It must be followed by a scaling factor. All text (NOT the graphs) will be scaled by this factor. Use this if you have math that you want at some size other than the default 10pt. Unfortunately, all math will be the same size, but see the discussion below on editing the MP output. mag will also work under notex but there seems no point in using it as the font size option (below) works as well.
The option psnfss uses postscript fonts in combination with LaTeX. Since this option only makes sense, if LaTeX is being used, the latex option is selected automatically. This option includes the following packages for LaTeX: inputenc(latin1), fontenc(T1), mathptmx, helvet(scaled=09.2), courier, latexsym and textcomp.
The option psnfss-version7 uses also postscript fonts in LaTeX (option latex is also automatically selected), but uses the following packages with LaTeX: inputenc(latin1), fontenc(T1), times, mathptmx, helvet and courier.
The option nopsnfss is the default and uses the standard font (cmr10 if not otherwise specified).
The option prologues takes a value as an additional argument and adds the line prologues:=<value> to the metapost file. If a value of 2 is specified metapost uses postscript fonts to generate the eps-file, so that the result can be viewed using e.g. ghostscript. Normally the output of metapost uses TeX fonts and therefore has to be included in a (La)TeX file before you can look at it.
The option noprologues is the default. No additional line specifying the prologue will be added.
The option a4paper adds a [a4paper] to the documentclass. Normally letter paper is used (default). Since this option is only used in case of LaTeX, the latex option is selected automatically.
The option amstex automatically selects the latex option and includes the following LaTeX packages: amsfonts, amsmath(intlimits). By default these packages are not included.
A name in quotes selects the font that will be used when no explicit font is given in a set label or set title. A name recognized by TeX (a TFM file exists) must be used. The default is "cmr10" unless notex is selected, then it is "pcrr8r" (Courier). Even under notex, a TFM file is needed by Metapost. The file pcrr8r.tfm is the name given to Courier in LaTeX's psnfss package. If you change the font from the notex default, choose a font that matches the ASCII encoding at least in the range 32-126. cmtt10 almost works, but it has a nonblank character in position 32 (space).
The size can be any number between 5.0 and 99.99. If it is omitted, 10.0 is used. It is advisable to use magstep sizes: 10 times an integer or half-integer power of 1.2, rounded to two decimals, because those are the most available sizes of fonts in TeX systems.
All the options are optional. If font information is given, it must be at the end, with size (if present) last. The size is needed to select a size for the font, even if the font name includes size information. For example, set term mp "cmtt12" selects cmtt12 shrunk to the default size 10. This is probably not what you want or you would have used cmtt10.
The following common ascii characters need special treatment in TeX:
$, &, #, %, _; |, <, >; ^, ~, \, {, and }
The five characters $, #, &, _, and % can simply be escaped, e.g., \$. The three characters <, >, and | can be wrapped in math mode, e.g., $<$. The remainder require some TeX work-arounds. Any good book on TeX will give some guidance.
If you type your labels inside double quotes, backslashes in TeX code need to be escaped (doubled). Using single quotes will avoid having to do this, but then you cannot use \n for line breaks. As of this writing, version 3.7 of gnuplot processes titles given in a plot command differently than in other places, and backslashes in TeX commands need to be doubled regardless of the style of quotes.
Metapost pictures are typically used in TeX documents. Metapost deals with fonts pretty much the same way TeX does, which is different from most other document preparation programs. If the picture is included in a LaTeX document using the graphics package, or in a plainTeX document via epsf.tex, and then converted to PostScript with dvips (or other dvi-to-ps converter), the text in the plot will usually be handled correctly. However, the text may not appear if you send the Metapost output as-is to a PostScript interpreter.
- Set your terminal to Metapost, e.g.:
set terminal mp mono "cmtt12" 12
- Select an output-file, e.g.:
set output "figure.mp"
- Create your pictures. Each plot (or multiplot group) will generate a separate Metapost beginfig...endfig group. Its default size will be 5 by 3 inches. You can change the size by saying set size 0.5,0.5 or whatever fraction of the default size you want to have.
- Quit gnuplot.
- Generate EPS files by running Metapost on the output of gnuplot:
mpost figure.mp OR mp figure.mp
The name of the Metapost program depends on the system, typically mpost for a Unix machine and mp on many others. Metapost will generate one EPS file for each picture.
- To include your pictures in your document you can use the graphics package in LaTeX or epsf.tex in plainTeX:
\usepackage{graphics} % LaTeX \input epsf.tex % plainTeX
If you use a driver other than dvips for converting TeX DVI output to PS, you may need to add the following line in your LaTeX document:
\DeclareGraphicsRule{*}{eps}{*}{}
Each picture you made is in a separate file. The first picture is in, e.g., figure.0, the second in figure.1, and so on.... To place the third picture in your document, for example, all you have to do is:
\includegraphics{figure.2} % LaTeX \epsfbox{figure.2} % plainTeX
The advantage, if any, of the mp terminal over a postscript terminal is editable output. Considerable effort went into making this output as clean as possible. For those knowledgeable in the Metapost language, the default line types and colors can be changed by editing the arrays lt[] and col[]. The choice of solid vs dashed lines, and color vs black lines can be change by changing the values assigned to the booleans dashedlines and colorlines. If the default tex option was in effect, global changes to the text of labels can be achieved by editing the vebatimtex...etex block. In particular, a LaTeX preamble can be added if desired, and then LaTeX's built-in size changing commands can be used for maximum flexibility. Be sure to set the appropriate MP configuration variable to force Metapost to run LaTeX instead of plainTeX.
Note: only available if gnuplot is configured --with-bitmap-terminals. Syntax:
set terminal pbm {<fontsize>} {<mode>} {size <x>,<y>}
where <fontsize> is small, medium, or large and <mode> is monochrome, gray or color. The default plot size is 640 pixels wide and 480 pixels high. The output size is white-space padded to the nearest multiple of 8 pixels on both x and y. This empty space may be cropped later if needed.
The output of the pbm driver depends upon <mode>: monochrome produces a portable bitmap (one bit per pixel), gray a portable graymap (three bits per pixel) and color a portable pixmap (color, four bits per pixel).
The output of this driver can be used with various image conversion and manipulation utilities provided by NETPBM. Based on Jef Poskanzer's PBMPLUS package, NETPBM provides programs to convert the above PBM formats to GIF, TIFF, MacPaint, Macintosh PICT, PCX, X11 bitmap and many others. Complete information is available at http://netpbm.sourceforge.net/.
Examples:
set terminal pbm small monochrome # defaults set terminal pbm color medium size 800,600 set output '| pnmrotate 45 | pnmtopng > tilted.png' # uses NETPBM
[DEPRECATED] This terminal uses the non-free library PDFlib (GmbH Munchen) to produce files in Portable Document Format. Unless you have a commercial license for PDFlib and need some special feature it provides you would do better to use the cairopdf terminal instead. Gnuplot can also export PDF files from wxt or qt interactive terminal sessions.
Syntax:
set terminal pdf {monochrome|color|colour} {{no}enhanced} {fname "<font>"} {fsize <fontsize>} {font "<fontname>{,<fontsize>}"} {fontscale <scale>} {linewidth <lw>} {rounded|butt} {dl <dashlength>}} {size <XX>{unit},<YY>{unit}}
The default is to use a different color for each line type. Selecting monochome will use black for all linetypes, Even in in mono mode you can still use explicit colors for filled areas or linestyles.
where <font> is the name of the default font to use (default Helvetica) and <fontsize> is the font size (in points, default 12). For help on which fonts are available or how to install new ones, please see the documentation for your local installation of pdflib.
The enhanced option enables enhanced text processing features (subscripts, superscripts and mixed fonts). See enhanced.
The width of all lines in the plot can be increased by the factor <n> specified in linewidth. Similarly dashlength is a multiplier for the default dash spacing.
rounded sets line caps and line joins to be rounded; butt is the default, butt caps and mitered joins.
The default size for PDF output is 5 inches by 3 inches. The size option changes this to whatever the user requests. By default the X and Y sizes are taken to be in inches, but other units are possible (currently only cm).
The pdfcairo terminal device generates output in pdf. The actual drawing is done via cairo, a 2D graphics library, and pango, a library for laying out and rendering text.
Syntax:
set term pdfcairo {{no}enhanced} {mono|color} {font <font>} {fontscale <scale>} {linewidth <lw>} {rounded|butt|square} {dashlength <dl>} {background <rgbcolor>} {size <XX>{unit},<YY>{unit}}
This terminal supports an enhanced text mode, which allows font and other formatting commands (subscripts, superscripts, etc.) to be embedded in labels and other text strings. The enhanced text mode syntax is shared with other gnuplot terminal types. See enhanced for more details.
The width of all lines in the plot can be modified by the factor <lw> specified in linewidth. The default linewidth is 0.5 points. (1 "PostScript" point = 1/72 inch = 0.353 mm)
rounded sets line caps and line joins to be rounded; butt is the default, butt caps and mitered joins.
The default size for the output is 5 inches x 3 inches. The size option changes this to whatever the user requests. By default the X and Y sizes are taken to be in inches, but other units are possible (currently only cm). Screen coordinates always run from 0.0 to 1.0 along the full length of the plot edges as specified by the size option.
<font> is in the format "FontFace,FontSize", i.e. the face and the size comma-separated in a single string. FontFace is a usual font face name, such as 'Arial'. If you do not provide FontFace, the pdfcairo terminal will use 'Sans'. FontSize is the font size, in points. If you do not provide it, the pdfcairo terminal will use a nominal font size of 12 points. However, the default fontscale parameter for this terminal is 0.5, so the apparent font size is smaller than this if the pdf output is viewed at full size.
For example : set term pdfcairo font "Arial,12" set term pdfcairo font "Arial" # to change the font face only set term pdfcairo font ",12" # to change the font size only set term pdfcairo font "" # to reset the font name and size
The fonts are retrieved from the usual fonts subsystems. Under Windows, those fonts are to be found and configured in the entry "Fonts" of the control panel. Under UNIX, they are handled by "fontconfig".
Pango, the library used to layout the text, is based on utf-8. Thus, the pdfcairo terminal has to convert from your encoding to utf-8. The default input encoding is based on your 'locale'. If you want to use another encoding, make sure gnuplot knows which one you are using. See encoding for more details.
Pango may give unexpected results with fonts that do not respect the unicode mapping. With the Symbol font, for example, the pdfcairo terminal will use the map provided by http://www.unicode.org/ to translate character codes to unicode. Note that "the Symbol font" is to be understood as the Adobe Symbol font, distributed with Acrobat Reader as "SY______.PFB". Alternatively, the OpenSymbol font, distributed with OpenOffice.org as "opens___.ttf", offers the same characters. Microsoft has distributed a Symbol font ("symbol.ttf"), but it has a different character set with several missing or moved mathematic characters. If you experience problems with your default setup (if the demo enhancedtext.dem is not displayed properly for example), you probably have to install one of the Adobe or OpenOffice Symbol fonts, and remove the Microsoft one. Other non-conform fonts, such as "wingdings" have been observed working.
The rendering of the plot cannot be altered yet. To obtain the best output possible, the rendering involves two mechanisms : antialiasing and oversampling. Antialiasing allows to display non-horizontal and non-vertical lines smoother. Oversampling combined with antialiasing provides subpixel accuracy, so that gnuplot can draw a line from non-integer coordinates. This avoids wobbling effects on diagonal lines ('plot x' for example).
The pm terminal driver provides an OS/2 Presentation Manager window in which the graph is plotted. The window is opened when the first graph is plotted. This window has its own online help as well as facilities for printing, copying to the clipboard.
Syntax:
set terminal pm {server {n}} {persist} {widelines} {enhanced} {"title"}
If persist is specified, each graph appears in its own window and all windows remain open after gnuplot exits. If server is specified, all graphs appear in the same window, which remains open when gnuplot exits. This option takes an optional numerical argument which specifies an instance of the server process. Thus multiple server windows can be in use at the same time.
If widelines is specified, all plots will be drawn with wide lines. If enhanced is specified, sub- and superscripts and multiple fonts are enabled (see enhanced text for details). Font names for the core PostScript fonts may be abbreviated to a single letter (T/H/C/S for Times/Helvetica/Courier/Symbol).
If title is specified, it will be used as the title of the plot window. It will also be used as the name of the server instance, and will override the optional numerical argument.
Syntax:
set terminal png {{no}enhanced} {{no}transparent} {{no}interlace} {{no}truecolor} {rounded|butt} {linewidth <lw>} {dashlength <dl>} {tiny | small | medium | large | giant} {font "<face> {,<pointsize>}"} {fontscale <scale>} {size <x>,<y>} {{no}crop} {background <rgb_color>}
PNG, JPEG and GIF images are created using the external library libgd. PNG plots may be viewed interactively by piping the output to the 'display' program from the ImageMagick package as follows:
set term png set output '| display png:-'
You can view the output from successive plot commands interactively by typing <space> in the display window. To save the current plot to a file, left click in the display window and choose save.
transparent instructs the driver to make the background color transparent. Default is notransparent.
interlace instructs the driver to generate interlaced PNGs. Default is nointerlace.
The linewidth and dashlength options are scaling factors that affect all lines drawn, i.e. they are multiplied by values requested in various drawing commands.
By default output png images use 256 indexed colors. The truecolor option instead creates TrueColor images with 24 bits of color information per pixel. Transparent fill styles require the truecolor option. See fillstyle. A transparent background is possible in either indexed or TrueColor images.
butt instructs the driver to use a line drawing method that does not overshoot the desired end point of a line. This setting is only applicable for line widths greater than 1. This setting is most useful when drawing horizontal or vertical lines. Default is rounded.
The details of font selection are complicated. Two equivalent simple examples are given below:
set term png font arial 11 set term png font "arial,11"
For more information please see the separate section under fonts.
The output plot size <x,y> is given in pixels---it defaults to 640x480. Please see additional information under canvas and set size. Blank space at the edges of the finished plot may be trimmed using the crop option, resulting in a smaller final image size. Default is nocrop.
set terminal png medium size 640,480 background '#ffffff'
Use the medium size built-in non-scaleable, non-rotatable font. Use white (24-bit RGB in hexadecimal) for the non-transparent background.
set terminal png font arial 14 size 800,600
Searches for a scalable font with face name 'arial' and sets the font size to 14pt. Please see fonts for details of how the font search is done.
set terminal png transparent truecolor enhanced
Use 24 bits of color information per pixel, with a transparent background. Use the enhanced text mode to control the layout of strings to be printed.
The pngcairo terminal device generates output in png. The actual drawing is done via cairo, a 2D graphics library, and pango, a library for laying out and rendering text.
Syntax:
set term pngcairo {{no}enhanced} {mono|color} {{no}transparent} {{no}crop} {background <rgbcolor> {font <font>} {fontscale <scale>} {linewidth <lw>} {rounded|butt|square} {dashlength <dl>} {pointscale <ps>} {size <XX>{unit},<YY>{unit}}
This terminal supports an enhanced text mode, which allows font and other formatting commands (subscripts, superscripts, etc.) to be embedded in labels and other text strings. The enhanced text mode syntax is shared with other gnuplot terminal types. See enhanced for more details.
The width of all lines in the plot can be modified by the factor <lw>.
rounded sets line caps and line joins to be rounded; butt is the default, butt caps and mitered joins.
The default size for the output is 640 x 480 pixels. The size option changes this to whatever the user requests. By default the X and Y sizes are taken to be in pixels, but other units are possible (currently cm and inch). A size given in centimeters or inches will be converted into pixels assuming a resolution of 72 dpi. Screen coordinates always run from 0.0 to 1.0 along the full length of the plot edges as specified by the size option.
<font> is in the format "FontFace,FontSize", i.e. the face and the size comma-separated in a single string. FontFace is a usual font face name, such as 'Arial'. If you do not provide FontFace, the pngcairo terminal will use 'Sans'. FontSize is the font size, in points. If you do not provide it, the pngcairo terminal will use a size of 12 points.
For example : set term pngcairo font "Arial,12" set term pngcairo font "Arial" # to change the font face only set term pngcairo font ",12" # to change the font size only set term pngcairo font "" # to reset the font name and size
The fonts are retrieved from the usual fonts subsystems. Under Windows, those fonts are to be found and configured in the entry "Fonts" of the control panel. Under UNIX, they are handled by "fontconfig".
Pango, the library used to layout the text, is based on utf-8. Thus, the pngcairo terminal has to convert from your encoding to utf-8. The default input encoding is based on your 'locale'. If you want to use another encoding, make sure gnuplot knows which one you are using. See encoding for more detail.
Pango may give unexpected results with fonts that do not respect the unicode mapping. With the Symbol font, for example, the pngcairo terminal will use the map provided by http://www.unicode.org/ to translate character codes to unicode. Note that "the Symbol font" is to be understood as the Adobe Symbol font, distributed with Acrobat Reader as "SY______.PFB". Alternatively, the OpenSymbol font, distributed with OpenOffice.org as "opens___.ttf", offers the same characters. Microsoft has distributed a Symbol font ("symbol.ttf"), but it has a different character set with several missing or moved mathematic characters. If you experience problems with your default setup (if the demo enhancedtext.dem is not displayed properly for example), you probably have to install one of the Adobe or OpenOffice Symbol fonts, and remove the Microsoft one.
Rendering uses oversampling, antialiasing, and font hinting to the extent supported by the cairo and pango libraries.
Several options may be set in the postscript driver.
Syntax:
set terminal postscript {default} set terminal postscript {landscape | portrait | eps} {enhanced | noenhanced} {defaultplex | simplex | duplex} {fontfile [add | delete] "<filename>" | nofontfiles} {{no}adobeglyphnames} {level1 | leveldefault | level3} {color | colour | monochrome} {background <rgbcolor> | nobackground} {dashlength | dl <DL>} {linewidth | lw <LW>} {pointscale | ps <PS>} {rounded | butt} {clip | noclip} {palfuncparam <samples>{,<maxdeviation>}} {size <XX>{unit},<YY>{unit}} {blacktext | colortext | colourtext} {{font} "fontname{,fontsize}" {<fontsize>}} {fontscale <scale>}
If you see the error message
"Can't find PostScript prologue file ... "
Please see and follow the instructions in postscript prologue.
landscape and portrait choose the plot orientation. eps mode generates EPS (Encapsulated PostScript) output, which is just regular PostScript with some additional lines that allow the file to be imported into a variety of other applications. (The added lines are PostScript comment lines, so the file may still be printed by itself.) To get EPS output, use the eps mode and make only one plot per file. In eps mode the whole plot, including the fonts, is reduced to half of the default size.
enhanced enables enhanced text mode features (subscripts, superscripts and mixed fonts). See enhanced for more information. blacktext forces all text to be written in black even in color mode;
Duplexing in PostScript is the ability of the printer to print on both sides of the same sheet of paper. With defaultplex, the default setting of the printer is used; with simplex only one side is printed; duplex prints on both sides (ignored if your printer can't do it).
"<fontname>" is the name of a valid PostScript font; and <fontsize> is the size of the font in PostScript points. In addition to the standard postscript fonts, an oblique version of the Symbol font, useful for mathematics, is defined. It is called "Symbol-Oblique".
default sets all options to their defaults: landscape, monochrome, dl 1.0, lw 1.0, defaultplex, enhanced, "Helvetica" and 14pt. Default size of a PostScript plot is 10 inches wide and 7 inches high. The option color enables color, while monochrome prefers black and white drawing elements. Further, monochrome uses gray palette but it does not change color of objects specified with an explicit colorspec. dashlength or dl scales the length of dashed-line segments by <DL>, which is a floating-point number greater than zero. linewidth or lw scales all linewidths by <LW>.
By default the generated PostScript code uses language features that were introduced in PostScript Level 2, notably filters and pattern-fill of irregular objects such as filledcurves. PostScript Level 2 features are conditionally protected so that PostScript Level 1 interpreters do not issue errors but, rather, display a message or a PostScript Level 1 approximation. The level1 option substitutes PostScript Level 1 approximations of these features and uses no PostScript Level 2 code. This may be required by some old printers and old versions of Adobe Illustrator. The flag level1 can be toggled later by editing a single line in the PostScript output file to force PostScript Level 1 interpretation. In the case of files containing level 2 code, the above features will not appear or will be replaced by a note when this flag is set or when the interpreting program does not indicate that it understands level 2 PostScript or higher. The flag level3 enables PNG encoding for bitmapped images, which can reduce the output size considerably.
rounded sets line caps and line joins to be rounded; butt is the default, butt caps and mitered joins.
clip tells PostScript to clip all output to the bounding box; noclip is the default.
palfuncparam controls how set palette functions are encoded as gradients in the output. Analytic color component functions (set via set palette functions) are encoded as linear interpolated gradients in the postscript output: The color component functions are sampled at <samples> points and all points are removed from this gradient which can be removed without changing the resulting colors by more than <maxdeviation>. For almost every useful palette you may safely leave the defaults of <samples>=2000 and <maxdeviation>=0.003 untouched.
The default size for postscript output is 10 inches x 7 inches. The default for eps output is 5 x 3.5 inches. The size option changes this to whatever the user requests. By default the X and Y sizes are taken to be in inches, but other units are possibly (currently only cm). The BoundingBox of the plot is correctly adjusted to contain the resized image. Screen coordinates always run from 0.0 to 1.0 along the full length of the plot edges as specified by the size option. NB: this is a change from the previously recommended method of using the set size command prior to setting the terminal type. The old method left the BoundingBox unchanged and screen coordinates did not correspond to the actual limits of the plot.
Fonts listed by fontfile or fontfile add encapsulate the font definitions of the listed font from a postscript Type 1 or TrueType font file directly into the gnuplot output postscript file. Thus, the enclosed font can be used in labels, titles, etc. See the section postscript fontfile for more details. With fontfile delete, a fontfile is deleted from the list of embedded files. nofontfiles cleans the list of embedded fonts.
Examples:
set terminal postscript default # old postscript set terminal postscript enhanced # old enhpost set terminal postscript landscape 22 # old psbig set terminal postscript eps 14 # old epsf1 set terminal postscript eps 22 # old epsf2 set size 0.7,1.4; set term post portrait color "Times-Roman" 14 set term post "VAGRoundedBT_Regular" 14 fontfile "bvrr8a.pfa"
Linewidths and pointsizes may be changed with set style line.
The postscript driver supports about 70 distinct pointtypes, selectable through the pointtype option on plot and set style line.
Several possibly useful files about gnuplot's PostScript are included in the /docs/psdoc subdirectory of the gnuplot distribution and at the distribution sites. These are "ps_symbols.gpi" (a gnuplot command file that, when executed, creates the file "ps_symbols.ps" which shows all the symbols available through the postscript terminal), "ps_guide.ps" (a PostScript file that contains a summary of the enhanced syntax and a page showing what the octal codes produce with text and symbol fonts), "ps_file.doc" (a text file that contains a discussion of the organization of a PostScript file written by gnuplot), and "ps_fontfile_doc.tex" (a LaTeX file which contains a short documentation concerning the encapsulation of LaTeX fonts with a glyph table of the math fonts).
A PostScript file is editable, so once gnuplot has created one, you are free to modify it to your heart's desire. See the editing postscript section for some hints.
The PostScript language is a very complex language---far too complex to describe in any detail in this document. Nevertheless there are some things in a PostScript file written by gnuplot that can be changed without risk of introducing fatal errors into the file.
For example, the PostScript statement "/Color true def" (written into the file in response to the command set terminal postscript color), may be altered in an obvious way to generate a black-and-white version of a plot. Similarly line colors, text colors, line weights and symbol sizes can also be altered in straight-forward ways. Text (titles and labels) can be edited to correct misspellings or to change fonts. Anything can be repositioned, and of course anything can be added or deleted, but modifications such as these may require deeper knowledge of the PostScript language.
The organization of a PostScript file written by gnuplot is discussed in the text file "ps_file.doc" in the docs/ps subdirectory of the gnuplot source distribution.
The fontfile or fontfile add option takes one file name as argument and encapsulates this file into the postscript output in order to make this font available for text elements (labels, tic marks, titles, etc.). The fontfile delete option also takes one file name as argument. It deletes this file name from the list of encapsulated files.
The postscript terminal understands some font file formats: Type 1 fonts in ASCII file format (extension ".pfa"), Type 1 fonts in binary file format (extension ".pfb"), and TrueType fonts (extension ".ttf"). Pfa files are understood directly, pfb and ttf files are converted on the fly if appropriate conversion tools are installed (see below). You have to specify the full filename including the extension. Each fontfile option takes exact one font file name. This option can be used multiple times in order to include more than one font file.
The font file is searched in the working directory and in all directories listed in the fontpath which is determined by set fontpath. In addition, the fontpath can be set using the environment variable GNUPLOT_FONTPATH. If this is not set a system dependent default search list is used. See set fontpath for more details.
For using the encapsulated font file you have to specify the font name (which normally is not the same as the file name). When embedding a font file by using the fontfile option in interactive mode, the font name is printed on the screen. E.g.
Font file 'p052004l.pfb' contains the font 'URWPalladioL-Bold'. Location: /usr/lib/X11/fonts/URW/p052004l.pfb
When using pfa or pfb fonts, you can also find it out by looking into the font file. There is a line similar to "/FontName /URWPalladioL-Bold def". The middle string without the slash is the fontname, here "URWPalladioL-Bold". For TrueType fonts, this is not so easy since the font name is stored in a binary format. In addition, they often have spaces in the font names which is not supported by Type 1 fonts (in which a TrueType is converted on the fly). The font names are changed in order to eliminate the spaces in the fontnames. The easiest way to find out which font name is generated for use with gnuplot, start gnuplot in interactive mode and type in "set terminal postscript fontfile '<filename.ttf>'".
For converting font files (either ttf or pfb) to pfa format, the conversion tool has to read the font from a file and write it to standard output. If the output cannot be written to standard output, on-the-fly conversion is not possible.
For pfb files "pfbtops" is a tool which can do this. If this program is installed on your system the on the fly conversion should work. Just try to encapsulate a pfb file. If the compiled in program call does not work correctly you can specify how this program is called by defining the environment variable GNUPLOT_PFBTOPFA e.g. to "pfbtops %s". The %s will be replaced by the font file name and thus has to exist in the string.
If you don't want to do the conversion on the fly but get a pfa file of the font you can use the tool "pfb2pfa" which is written in simple c and should compile with any c compiler. It is available from many ftp servers, e.g.
ftp://ftp.dante.de/tex-archive/fonts/utilities/ps2mf/
In fact, "pfbtopfa" and "pfb2ps" do the same job. "pfbtopfa" puts the resulting pfa code into a file, whereas "pfbtops" writes it to standard output.
TrueType fonts are converted into Type 1 pfa format, e.g. by using the tool "ttf2pt1" which is available from
http://ttf2pt1.sourceforge.net/
If the builtin conversion does not work, the conversion command can be changed by the environment variable GNUPLOT_TTFTOPFA. For usage with ttf2pt1 it may be set to "ttf2pt1 -a -e -W 0 %s - ". Here again, %s stands for the file name.
For special purposes you also can use a pipe (if available for your operating system). Therefore you start the file name definition with the character "<" and append a program call. This program has to write pfa data to standard output. Thus, a pfa file may be accessed by set fontfile "< cat garamond.pfa".
For example, including Type 1 font files can be used for including the postscript output in LaTeX documents. The "european computer modern" font (which is a variant of the "computer modern" font) is available in pfb format from any CTAN server, e.g.
ftp://ftp.dante.de/tex-archive/fonts/ps-type1/cm-super/
For example, the file "sfrm1000.pfb" contains the normal upright fonts with serifs in the design size 10pt (font name "SFRM1000"). The computer modern fonts, which are still necessary for mathematics, are available from
ftp://ftp.dante.de/tex-archive/fonts/cm/ps-type1/bluesky
With these you can use any character available in TeX. However, the computer modern fonts have a strange encoding. (This is why you should not use cmr10.pfb for text, but sfrm1000.pfb instead.) The usage of TeX fonts is shown in one of the demos. The file "ps_fontfile_doc.tex" in the /docs/psdoc subdirectory of the gnuplot source distribution contains a table with glyphs of the TeX mathfonts.
If the font "CMEX10" is embedded (file "cmex10.pfb") gnuplot defines the additional font "CMEX10-Baseline". It is shifted vertically in order to fit better to the other glyphs (CMEX10 has its baseline at the top of the symbols).
Each PostScript output file includes a %%Prolog section and possibly some additional user-defined sections containing, for example, character encodings. These sections are copied from a set of PostScript prologue files that are either compiled into the gnuplot executable or stored elsewhere on your computer. A default directory where these files live is set at the time gnuplot is built. However, you can override this default either by using the gnuplot command set psdir or by defining an environment variable GNUPLOT_PS_DIR. See set psdir.
This setting is only relevant to PostScript output with UTF-8 encoding. It controls the names used to describe characters with Unicode entry points higher than 0x00FF. That is, all characters outside of the Latin1 set. In general unicode characters do not have a unique name; they have only a unicode identification code. However, Adobe have a recommended scheme for assigning names to certain ranges of characters (extended Latin, Greek, etc). Some fonts use this scheme, others do not. By default, gnuplot will use the Adobe glyph names. E.g. the lower case Greek letter alpha will be called /alpha. If you specific noadobeglyphnames then instead gnuplot will use /uni03B1 to describe this character. If you get this setting wrong, the character may not be found even if it is present in the font. It is probably always correct to use the default for Adobe fonts, but for other fonts you may have to try both settings. See also fontfile.
The pslatex driver generates output for further processing by LaTeX, while the pstex driver generates output for further processing by TeX. pslatex uses \specials understandable by dvips and xdvi. Figures generated by pstex can be included in any plain-based format (including LaTeX).
Syntax:
set terminal [pslatex | pstex] {default} set terminal [pslatex | pstex] {rotate | norotate} {oldstyle | newstyle} {auxfile | noauxfile} {level1 | leveldefault | level3} {color | colour | monochrome} {background <rgbcolor> | nobackground} {dashlength | dl <DL>} {linewidth | lw <LW>} {pointscale | ps <PS>} {rounded | butt} {clip | noclip} {palfuncparam <samples>{,<maxdeviation>}} {size <XX>{unit},<YY>{unit}} {<font_size>}
If you see the error message
"Can't find PostScript prologue file ... "
Please see and follow the instructions in postscript prologue.
The option color enables color, while monochrome prefers black and white drawing elements. Further, monochrome uses gray palette but it does not change color of objects specified with an explicit colorspec. dashlength or dl scales the length of dashed-line segments by <DL>, which is a floating-point number greater than zero. linewidth or lw scales all linewidths by <LW>.
By default the generated PostScript code uses language features that were introduced in PostScript Level 2, notably filters and pattern-fill of irregular objects such as filledcurves. PostScript Level 2 features are conditionally protected so that PostScript Level 1 interpreters do not issue errors but, rather, display a message or a PostScript Level 1 approximation. The level1 option substitutes PostScript Level 1 approximations of these features and uses no PostScript Level 2 code. This may be required by some old printers and old versions of Adobe Illustrator. The flag level1 can be toggled later by editing a single line in the PostScript output file to force PostScript Level 1 interpretation. In the case of files containing level 2 code, the above features will not appear or will be replaced by a note when this flag is set or when the interpreting program does not indicate that it understands level 2 PostScript or higher. The flag level3 enables PNG encoding for bitmapped images, which can reduce the output size considerably.
rounded sets line caps and line joins to be rounded; butt is the default, butt caps and mitered joins.
clip tells PostScript to clip all output to the bounding box; noclip is the default.
palfuncparam controls how set palette functions are encoded as gradients in the output. Analytic color component functions (set via set palette functions) are encoded as linear interpolated gradients in the postscript output: The color component functions are sampled at <samples> points and all points are removed from this gradient which can be removed without changing the resulting colors by more than <maxdeviation>. For almost every useful palette you may safely leave the defaults of <samples>=2000 and <maxdeviation>=0.003 untouched.
The default size for postscript output is 10 inches x 7 inches. The default for eps output is 5 x 3.5 inches. The size option changes this to whatever the user requests. By default the X and Y sizes are taken to be in inches, but other units are possibly (currently only cm). The BoundingBox of the plot is correctly adjusted to contain the resized image. Screen coordinates always run from 0.0 to 1.0 along the full length of the plot edges as specified by the size option. NB: this is a change from the previously recommended method of using the set size command prior to setting the terminal type. The old method left the BoundingBox unchanged and screen coordinates did not correspond to the actual limits of the plot.
if rotate is specified, the y-axis label is rotated. <font_size> is the size (in pts) of the desired font.
If auxfile is specified, it directs the driver to put the PostScript commands into an auxiliary file instead of directly into the LaTeX file. This is useful if your pictures are large enough that dvips cannot handle them. The name of the auxiliary PostScript file is derived from the name of the TeX file given on the set output command; it is determined by replacing the trailing .tex (actually just the final extent in the file name) with .ps in the output file name, or, if the TeX file has no extension, .ps is appended. The .ps is included into the .tex file by a \special{psfile=...} command. Remember to close the output file before next plot unless in multiplot mode.
Gnuplot versions prior to version 4.2 generated plots of the size 5 x 3 inches using the ps(la)tex terminal while the current version generates 5 x 3.5 inches to be consistent with the postscript eps terminal. In addition, the character width is now estimated to be 60% of the font size while the old epslatex terminal used 50%. To reach the old format specify the option oldstyle.
The pslatex driver offers a special way of controlling text positioning: (a) If any text string begins with '{', you also need to include a '}' at the end of the text, and the whole text will be centered both horizontally and vertically by LaTeX. (b) If the text string begins with '[', you need to continue it with: a position specification (up to two out of t,b,l,r), ']{', the text itself, and finally, '}'. The text itself may be anything LaTeX can typeset as an LR-box. \rule{}{}'s may help for best positioning.
The options not described here are identical to the Postscript terminal. Look there if you want to know what they do.
Examples:
set term pslatex monochrome rotate # set to defaults
To write the PostScript commands into the file "foo.ps":
set term pslatex auxfile set output "foo.tex"; plot ...; set output
About label positioning: Use gnuplot defaults (mostly sensible, but sometimes not really best):
set title '\LaTeX\ -- $ \gamma $'
Force centering both horizontally and vertically:
set label '{\LaTeX\ -- $ \gamma $}' at 0,0
Specify own positioning (top here):
set xlabel '[t]{\LaTeX\ -- $ \gamma $}'
The other label -- account for long ticlabels:
set ylabel '[r]{\LaTeX\ -- $ \gamma $\rule{7mm}{0pt}}'
Linewidths and pointsizes may be changed with set style line.
The pstricks driver is intended for use with the "pstricks.sty" macro package for LaTeX. It is an alternative to the eepic and latex drivers. You need "pstricks.sty", and, of course, a printer that understands PostScript, or a converter such as Ghostscript.
PSTricks is available via anonymous ftp from the /pub directory at Princeton.edu. This driver definitely does not come close to using the full capability of the PSTricks package.
Syntax:
set terminal pstricks {hacktext | nohacktext} {unit | nounit}
The first option invokes an ugly hack that gives nicer numbers; the second has to do with plot scaling. The defaults are hacktext and nounit.
The qms terminal driver supports the QMS/QUIC Laser printer, the Talaris 1200 and others. It has no options.
The qt terminal device generates output in a separate window with the Qt library. Syntax:
set term qt {<n>} {size <width>,<height>} {position <x>,<y>} {title "title"} {font <font>} {{no}enhanced} {linewidth <lw>} {dashlength <dl>} {{no}persist} {{no}raise} {{no}ctrl} {close} {widget <id>}
Multiple plot windows are supported: set terminal qt <n> directs the output to plot window number n.
The default window title is based on the window number. This title can also be specified with the keyword "title".
Plot windows remain open even when the gnuplot driver is changed to a different device. A plot window can be closed by pressing the letter 'q' while that window has input focus, by choosing close from a window manager menu, or with set term qt <n> close.
The size of the plot area is given in pixels, it defaults to 640x480. In addition to that, the actual size of the window also includes the space reserved for the toolbar and the status bar. When you resize a window, the plot is immediately scaled to fit in the new size of the window. The qt terminal scales the whole plot, including fonts and linewidths, and keeps its global aspect ratio constant. If you type replot, click the replot icon in the terminal toolbar or type a new plot command, the new plot will completely fit in the window and the font size and the linewidths will be reset to their defaults.
The position option can be used to set the position of the plot window. The position option only applies to the first plot after the set term command.
The active plot window (the one selected by set term qt <n>) is interactive. Its behaviour is shared with other terminal types. See mouse for details. It also has some extra icons, which are supposed to be self-explanatory.
This terminal supports an enhanced text mode, which allows font and other formatting commands (subscripts, superscripts, etc.) to be embedded in labels and other text strings. The enhanced text mode syntax is shared with other gnuplot terminal types. See enhanced for more details.
<font> is in the format "FontFace,FontSize", i.e. the face and the size comma-separated in a single string. FontFace is a usual font face name, such as 'Arial'. If you do not provide FontFace, the qt terminal will use 'Sans'. FontSize is the font size, in points. If you do not provide it, the qt terminal will use a size of 9 points.
For example : set term qt font "Arial,12" set term qt font "Arial" # to change the font face only set term qt font ",12" # to change the font size only set term qt font "" # to reset the font name and size
The dashlength affects only custom dash patterns, not Qt's built-in set.
To obtain the best output possible, the rendering involves three mechanisms : antialiasing, oversampling and hinting. Oversampling combined with antialiasing provides subpixel accuracy, so that gnuplot can draw a line from non-integer coordinates. This avoids wobbling effects on diagonal lines ('plot x' for example). Hinting avoids the blur on horizontal and vertical lines caused by oversampling. The terminal will snap these lines to integer coordinates so that a one-pixel-wide line will actually be drawn on one and only one pixel.
By default, the window is raised to the top of your desktop when a plot is drawn. This can be controlled with the keyword "raise". The keyword "persist" will prevent gnuplot from exiting before you explicitely close all the plot windows. Finally, by default the <space> key raises the gnuplot console window [MS Windows only], and 'q' closes the plot window. The keyword "ctrl" allows you to replace those bindings by <ctrl>+<space> and <ctrl>+'q'.
The gnuplot outboard driver, gnuplot_qt, is searched in a default place chosen when the program is compiled. You can override that by defining the environment variable GNUPLOT_DRIVER_DIR.
Note: legacy terminal. The regis terminal device generates output in the REGIS graphics language. It has the option of using 4 (the default) or 16 colors.
Syntax:
set terminal regis {4 | 16}
Syntax:
set terminal sixelgd {{no}enhanced} {{no}transparent} {rounded|butt} {linewidth <lw>} {dashlength <dl>} {tiny | small | medium | large | giant} {font "<face> {,<pointsize>}"} {fontscale <scale>} {size <x>,<y>} {{no}crop} {animate} {background <rgb_color>}
The sixel output format was originally used by DEC terminals and printers. This driver produces a sixel output stream by converting a PNG image created internally using the gd library. The sixel output stream can be viewed in the terminal as it is created or it can be written to a file so that it can be replayed later by echoing the file to the terminal.
The animate option resets the cursor position to the terminal top left at the start of every plot so that successive plots overwrite the same area on the screen rather than having earlier plots scroll off the top. This may be desirable in order to create an in-place animation.
transparent instructs the driver to make the background color transparent. Default is notransparent.
The linewidth and dashlength options are scaling factors that affect all lines drawn, i.e. they are multiplied by values requested in various drawing commands.
By default the sixel output uses 16 indexed colors. The truecolor option instead creates a TrueColor png image that is mapped down onto 256 colors in the output sixel image. Transparent fill styles require the truecolor option. See fillstyle. A transparent background is possible in either indexed or TrueColor images.
butt instructs the driver to use a line drawing method that does not overshoot the desired end point of a line. This setting is only applicable for line widths greater than 1. This setting is most useful when drawing horizontal or vertical lines. Default is rounded.
The details of font selection are complicated. For more information please see fonts.
The output plot size <x,y> is given in pixels---it defaults to 640x480. Please see additional information under canvas and set size. Blank space at the edges of the finished plot may be trimmed using the crop option, resulting in a smaller final image size. Default is nocrop. The terminal has been sucessfully tested with the xterm, mlterm and mintty terminals. The later two support the truecolor mode using 256 sixel colors out of box. Distributed copies of xterm may or may not have been configured to support sixel graphics and 256 colors.
This terminal produces files in the W3C Scalable Vector Graphics format.
Syntax:
set terminal svg {size <x>,<y> {|fixed|dynamic}} {mouse} {standalone | jsdir <dirname>} {name <plotname>} {font "<fontname>{,<fontsize>}"} {{no}enhanced} {fontscale <multiplier>} {rounded|butt|square} {solid|dashed} {linewidth <lw>} {background <rgb_color>}
where <x> and <y> are the size of the SVG plot to generate, dynamic allows a svg-viewer to resize plot, whereas the default setting, fixed, will request an absolute size.
linewidth <w> increases the width of all lines used in the figure by a factor of <w>.
<font> is the name of the default font to use (default Arial) and <fontsize> is the font size (in points, default 12). SVG viewing programs may substitute other fonts when the file is displayed.
The enhanced text mode syntax is shared with other gnuplot terminal types. See enhanced for more details.
The mouse option tells gnuplot to add support for mouse tracking and for toggling individual plots on/off by clicking on the corresponding key entry. By default this is done by including a link that points to a script in a local directory, usually /usr/local/share/gnuplot/<version>/js. You can change this by using the jsdir option to specify either a different local directory or a general URL. The latter is usually appropriate if you are embedding the svg into a web page. Alternatively, the standalone option embeds the mousing code in the svg document itself rather than linking to an external resource.
When an SVG file will be used in conjunction with external files, e.g. if it is referenced by javascript code in a web page or parent document, then a unique name is required to avoid potential conflicting references to other SVG plots. Use the name option to ensure uniqueness.
Legacy terminal. The svga terminal driver supports PCs with SVGA graphics.
Syntax:
set terminal svga {"<fontname>"}
This family of terminal drivers supports a variety of VT-like terminals. tek40xx supports Tektronix 4010 and others as well as most TEK emulators. vttek supports VT-like tek40xx terminal emulators. The following are present only if selected when gnuplot is built: kc-tek40xx supports MS-DOS Kermit Tek4010 terminal emulators in color; km-tek40xx supports them in monochrome. selanar supports Selanar graphics. bitgraph supports BBN Bitgraph terminals. None have any options.
The tek410x terminal driver supports the 410x and 420x family of Tektronix terminals. It has no options.
The texdraw terminal driver supports the LaTeX texdraw environment. It is intended for use with "texdraw.sty" and "texdraw.tex" in the texdraw package.
Points, among other things, are drawn using the LaTeX commands "\Diamond" and "\Box". These commands no longer belong to the LaTeX2e core; they are included in the latexsym package, which is part of the base distribution and thus part of any LaTeX implementation. Please do not forget to use this package.
It has no options.
Tgif is an X11-based drawing tool---it has nothing to do with GIF.
The tgif driver supports a choice of font and font size and multiple graphs on the page. The proportions of the axes are not changed.
Syntax:
set terminal tgif {portrait | landscape | default} {<[x,y]>} {monochrome | color} {{linewidth | lw} <LW>} {solid | dashed} {font "<fontname>{,<fontsize>}"}
where <[x,y]> specifies the number of graphs in the x and y directions on the page, color enables color, linewidth scales all linewidths by <LW>, "<fontname>" is the name of a valid PostScript font, and <fontsize> specifies the size of the PostScript font. defaults sets all options to their defaults: portrait, [1,1], color, linewidth 1.0, dashed, "Helvetica,18".
The solid option is usually prefered if lines are colored, as they often are in the editor. Hardcopy will be black-and-white, so dashed should be chosen for that.
Multiplot is implemented in two different ways.
The first multiplot implementation is the standard gnuplot multiplot feature:
set terminal tgif set output "file.obj" set multiplot set origin x01,y01 set size xs,ys plot ... ... set origin x02,y02 plot ... unset multiplot
See set multiplot for further information.
The second version is the [x,y] option for the driver itself. The advantage of this implementation is that everything is scaled and placed automatically without the need for setting origins and sizes; the graphs keep their natural x/y proportions of 3/2 (or whatever is fixed by set size).
If both multiplot methods are selected, the standard method is chosen and a warning message is given.
Examples of single plots (or standard multiplot):
set terminal tgif # defaults set terminal tgif "Times-Roman,24" set terminal tgif landscape set terminal tgif landscape solid
Examples using the built-in multiplot mechanism:
set terminal tgif portrait [2,4] # portrait; 2 plots in the x- # and 4 in the y-direction set terminal tgif [1,2] # portrait; 1 plot in the x- # and 2 in the y-direction set terminal tgif landscape [3,3] # landscape; 3 plots in both # directions
This driver creates output for use with the TikZ package of graphics macros in TeX. It is currently implemented via an external lua script, and set term tikz is a short form of the command set term lua tikz. See term lua for more information. Use the command set term tikz help to print terminal options.
This terminal driver generates Tk canvas widget commands in one of the following scripting languages: Tcl (default), Perl, Python, Ruby, or REXX.
Syntax:
set terminal tkcanvas {tcl | perl | perltkx | python | ruby | rexx} {standalone | input} {interactive} {rounded | butt} {nobackground | background <rgb color>} {{no}rottext} {size <width>,<height>} {{no}enhanced} {externalimages | pixels}
Execute the following sequence of Tcl/Tk commands to display the result:
package require Tk # the following two lines are only required to support external images package require img::png source resize.tcl source plot.tcl canvas .c -width 800 -height 600 pack .c gnuplot .c
Or, for Perl/Tk use a program like this:
use Tk; my $top = MainWindow->new; my $c = $top->Canvas(-width => 800, -height => 600)->pack; my $gnuplot = do "plot.pl"; $gnuplot->($c); MainLoop;
Or, for Perl/Tkx use a program like this:
use Tkx; my $top = Tkx::widget->new("."); my $c = $top->new_tk__canvas(-width => 800, -height => 600); $c->g_pack; my $gnuplot = do "plot.pl"; $gnuplot->($c); Tkx::MainLoop();
Or, for Python/Tkinter use a program like this:
from tkinter import * from tkinter import font root = Tk() c = Canvas(root, width=800, height=600) c.pack() exec(open('plot.py').read()) gnuplot(c) root.mainloop()
Or, for Ruby/Tk use a program like this:
require 'tk' root = TkRoot.new { title 'Ruby/Tk' } c = TkCanvas.new(root, 'width'=>800, 'height'=>600) { pack { } } load('plot.rb') gnuplot(c) Tk.mainloop
Or, for Rexx/Tk use a program like this:
/**/ call RxFuncAdd 'TkLoadFuncs', 'rexxtk', 'TkLoadFuncs' call TkLoadFuncs cv = TkCanvas('.c', '-width', 800, '-height', 600) call TkPack cv call 'plot.rex' cv do forever cmd = TkWait() if cmd = 'AWinClose' then leave interpret 'call' cmd end
The code generated by gnuplot (in the above examples, this code is written to "plot.<ext>") contains the following procedures:
gnuplot(canvas)
takes the name of a canvas as its argument. When called, it clears the canvas, finds the size of the canvas and draws the plot in it, scaled to fit.
gnuplot_plotarea()
returns a list containing the borders of the plotting area (xleft, xright, ytop, ybot) in canvas screen coordinates. It works only for 2-dimensional plotting (`plot`).
gnuplot_axisranges()
returns the ranges of the two axes in plot coordinates (x1min, x1max, y1min, y1max, x2min, x2max, y2min, y2max). It works only for 2-dimensional plotting (`plot`).
You can create self-contained, minimal scripts using the standalone option. The default is input which creates scripts which have to be source'd (or loaded or called or whatever the adequate term is for the language selected).
If the interactive option is specified, mouse clicking on a line segment will print the coordinates of its midpoint to stdout. The user can supersede this behavior by supplying a procedure user_gnuplot_coordinates which takes the following arguments:
win id x1s y1s x2s y2s x1e y1e x2e y2e x1m y1m x2m y2m,
i.e. the name of the canvas and the id of the line segment followed by the coordinates of its start and end point in the two possible axis ranges; the coordinates of the midpoint are only filled for logarithmic axes.
By default the canvas is transparent, but an explicit background color can be set with the background option.
rounded sets line caps and line joins to be rounded; butt is the default: butt caps and mitered joins.
Text at arbitrary angles can be activated with the rottext option, which requires Tcl/Tk 8.6 or later. The default is norottext.
The size option tries to optimize the tic and font sizes for the given canvas size. By default an output size of 800 x 600 pixels is assumed.
enhanced selects enhanced text processing (default), but is currently only available for Tcl.
The pixels (default) option selects the failsafe pixel-by-pixel image handler, see also image pixels. The externalimages option saves images as external png images, which are later loaded and scaled by the tkcanvas code. This option is only available for Tcl and display may be slow in some situations since the Tk image handler does not provide arbitrary scaling. Scripts need to source the provided rescale.tcl.
Interactive mode is not yet implemented for Python/Tk and Rexx/Tk. Interactive mode for Ruby/Tk does not yet support user_gnuplot_coordinates.
The tpic terminal driver supports the LaTeX picture environment with tpic \specials. It is an alternative to the latex and eepic terminal drivers. Options are the point size, line width, and dot-dash interval.
Syntax:
set terminal tpic <pointsize> <linewidth> <interval>
where pointsize and linewidth are integers in milli-inches and interval is a float in inches. If a non-positive value is specified, the default is chosen: pointsize = 40, linewidth = 6, interval = 0.1.
All drivers for LaTeX offer a special way of controlling text positioning: If any text string begins with '{', you also need to include a '}' at the end of the text, and the whole text will be centered both horizontally and vertically by LaTeX. --- If the text string begins with '[', you need to continue it with: a position specification (up to two out of t,b,l,r), ']{', the text itself, and finally, '}'. The text itself may be anything LaTeX can typeset as an LR-box. \rule{}{}'s may help for best positioning.
Examples: About label positioning: Use gnuplot defaults (mostly sensible, but sometimes not really best):
set title '\LaTeX\ -- $ \gamma $'
Force centering both horizontally and vertically:
set label '{\LaTeX\ -- $ \gamma $}' at 0,0
Specify own positioning (top here):
set xlabel '[t]{\LaTeX\ -- $ \gamma $}'
The other label -- account for long ticlabels:
set ylabel '[r]{\LaTeX\ -- $ \gamma $\rule{7mm}{0pt}}'
DEPRECATED (will be removed in next gnuplot release). The vgagl driver is a fast linux console driver with full mouse and pm3d support. It looks at the environment variable SVGALIB_DEFAULT_MODE for the default mode; if not set, it uses a 256 color mode with the highest available resolution.
Syntax:
set terminal vgagl \ background [red] [[green] [blue]] \ [uniform | interpolate] \ [mode]
The color mode can also be given with the mode option. Both Symbolic names as G1024x768x256 and integers are allowed. The background option takes either one or three integers in the range [0, 255]. If only one integers is supplied, it is taken as gray value for the background. If three integers are present, the background gets the corresponding color. The (mutually exclusive) options interpolate and uniform control if color interpolation is done while drawing triangles (on by default).
To get high resolution modes, you will probably have to modify the configuration file of libvga, usually /etc/vga/libvga.conf. Using the VESA fb is a good choice, but this needs to be compiled in the kernel.
The vgagl driver uses the first *available* vga mode from the following list:
G1024x768x256` would first check, if the G1024x768x256 mode is available.
Note: legacy terminal. The VWS terminal driver supports the VAX Windowing System. It has no options. It will sense the display type (monochrome, gray scale, or color.) All line styles are plotted as solid lines.
The windows terminal is a fast interactive terminal driver that uses the Windows GDI to draw and write text. The cross-platform terminal wxt and terminal qt are also supported on Windows.
Syntax:
set terminal windows {<n>} {color | monochrome} {solid | dashed} {rounded | butt} {enhanced | noenhanced} {font <fontspec>} {fontscale <scale>} {linewdith <scale>} {pointscale <scale>} {background <rgb color>} {title "Plot Window Title"} {{size | wsize} <width>,<height>} {position <x>,<y>} {docked {layout <rows>,<cols>} | standalone} {close}
Multiple plot windows are supported: set terminal win <n> directs the output to plot window number n.
color and monochrome select colored or mono output, dashed and solid select dashed or solid lines. Note that color defaults to solid, whereas monochrome defaults to dashed. rounded sets line caps and line joins to be rounded; butt is the default, butt caps and mitered joins. enhanced enables enhanced text mode features (subscripts, superscripts and mixed fonts, see enhanced text for more information). <fontspec> is in the format "<fontface>,<fontsize>", where "<fontface>" is the name of a valid Windows font, and <fontsize> is the size of the font in points and both components are optional. Note that in previous versions of gnuplot the font statement could be left out and <fontsize> could be given as a number without double quotes. This is no longer supported. linewidth, fontscale, pointscale can be used to scale the width of lines, the size of text, or the size of the point symbols. title changes the title of the graph window. size defines the width and height of the window's drawing area in pixels, wsize defines the actual size of the window itself and position defines the origin of the window i.e. the position of the top left corner on the screen (again in pixel). These options override any default settings from the wgnuplot.ini file.
docked embeds the graph window in the wgnuplot text window and the size and position options are ignored. Note that docked is not available for console-mode gnuplot. Setting this option changes the default for new windows. The initial default is standalone. The layout option allows to reserve a minimal number of columns and rows for graphs in docked mode. If there are more graphs than fit the given layout, additional rows will be added. Graphs are sorted by the numerical id, filling rows first.
Other options may be changed using the graph-menu or the initialization file wgnuplot.ini.
The Windows version normally terminates immediately as soon as the end of any files given as command line arguments is reached (i.e. in non-interactive mode), unless you specify - as the last command line option. It will also not show the text-window at all, in this mode, only the plot. By giving the optional argument -persist (same as for gnuplot under x11; former Windows-only options /noend or -noend are still accepted as well), will not close gnuplot. Contrary to gnuplot on other operating systems, gnuplot's interactive command line is accessible after the -persist option.
The plot window remains open when the gnuplot terminal is changed with a set term command. The plot window can be closed with set term windows close.
gnuplot supports different methods to create printed output on Windows, see windows printing. The windows terminal supports data exchange with other programs via clipboard and EMF files, see graph-menu. You can also use the terminal emf to create EMF files.
The gnuplot graph window has the following options on a pop-up menu accessed by pressing the right mouse button(*) or selecting Options from the system menu or the toolbar:
Copy to Clipboard copies a bitmap and an enhanced metafile picture.
Save as EMF... allows the user to save the current graph window as enhanced metafile (EMF or EMF+).
Save as Bitmap... allows the user to save a copy of the graph as bitmap file.
Print... prints the graphics windows using a Windows printer driver and allows selection of the printer and scaling of the output. See also windows printing.
Bring to Top when checked raises the graph window to the top after every plot.
Color when checked enables color output. When unchecked it forces all grayscale output. This is e.g. useful to test appearance of monochrome printouts.
GDI backend draws to the screen using Windows GDI. This is the classical windows terminal, which is fast, but lacks many features such as anti-aliasing, oversampling and full transparency support. It is now deprecated.
GDI+ backend draws to the screen using the GDI+ Windows API. It supports full antialiasing, oversampling, transparency and custom dash patterns. This is the currently preferred variant.
Direct2D backend uses Direct2D & DirectWrite APIs to draw. It uses graphic card acceleration and is hence typically much faster. Printing, saving and copying to clipboard fall back to GDI+. This will become the default backend but is currently still considered experimental.
Oversampling draws diagonal lines at fractional pixel positions to avoid "wobbling" effects. Vertical or horizontal lines are still snapped to integer pixel positions to avoid blurry lines.
Antialiasing enables smoothing of lines and edges. Note that this slows down drawing. Antialiasing of polygons is enabled by default but might slow down drawing with the GDI+ backend.
Fast rotation switches antialiasing temporarily off while rotating the graph with the mouse. This speeds up drawing considerably at the expense of an additional redraw after releasing the mouse button.
Background... sets the window background color.
Choose Font... selects the font used in the graphics window.
Update wgnuplot.ini saves the current window locations, window sizes, text window font, text window font size, graph window font, graph window font size, background color to the initialization file wgnuplot.ini.
(*) Note that this menu is only available by pressing the right mouse button with unset mouse.
In order of preference, graphs may be printed in the following ways:
1. Use the gnuplot command set terminal to select a printer and set output to redirect output to a file.
2. Select the Print... command from the gnuplot graph window. An extra command screendump does this from the text window.
3. If set output "PRN" is used, output will go to a temporary file. When you exit from gnuplot or when you change the output with another set output command, a dialog box will appear for you to select a printer port. If you choose OK, the output will be printed on the selected port, passing unmodified through the print manager. It is possible to accidentally (or deliberately) send printer output meant for one printer to an incompatible printer.
The gnuplot text window has the following options on a pop-up menu accessed by pressing the right mouse button or selecting Options from the system menu:
Copy to Clipboard copies marked text to the clipboard.
Paste copies text from the clipboard as if typed by the user.
Choose Font... selects the font used in the text window.
System Colors when selected makes the text window honor the System Colors set using the Control Panel. When unselected, text is black or blue on a white background.
Wrap long lines when selected lines longer than the current window width are wrapped.
Update wgnuplot.ini saves the current settings to the initialisation file wgnuplot.ini, which is located in the user's application data directory.
If the menu file wgnuplot.mnu is found in the same directory as gnuplot, then the menu specified in wgnuplot.mnu will be loaded. Menu commands:
Macros take two lines with the macro name (menu entry) on the first line and the macro on the second line. Leading spaces are ignored. Macro commands:
terminated by [EOS], followed by a default filename terminated by [EOS] or {ENTER}.
terminated by [EOS] or {ENTER}
Macro character substitutions:
Macros are limited to 256 characters after expansion.
The Windows text window and the windows terminal will read some of their options from the [WGNUPLOT] section of wgnuplot.ini. This file is located in the user's application data directory. Here's a sample wgnuplot.ini file:
[WGNUPLOT] TextOrigin=0 0 TextSize=640 150 TextFont=Consolas,9 TextWrap=1 TextLines=400 TextMaximized=0 SysColors=0 GraphOrigin=0 150 GraphSize=640 330 GraphFont=Tahoma,10 GraphColor=1 GraphToTop=1 GraphGDI+=1 GraphD2D=0 GraphGDI+Oversampling=1 GraphAntialiasing=1 GraphPolygonAA=1 GraphFastRotation=1 GraphBackground=255 255 255 DockVerticalTextFrac=350 DockHorizontalTextFrac=400
These settings apply to the wgnuplot text-window only. The TextOrigin and TextSize entries specify the location and size of the text window. If TextMaximized is non-zero, the window will be maximized.
The TextFont entry specifies the text window font and size.
The TextWrap entry selects wrapping of long text lines.
The TextLines entry specifies the number of (unwrapped) lines the internal buffer of the text window can hold. This value currently cannot be changed from within wgnuplot.
See text-menu.
DockVerticalTextFrac and DockHorizontalTextFrac set the fraction of the window reserved for the text window in permille of the vertical or horizontal layout.
The GraphFont entry specifies the font name and size in points.
See graph-menu.
The wxt terminal device generates output in a separate window. The window is created by the wxWidgets library, where the 'wxt' comes from. The actual drawing is done via cairo, a 2D graphics library, and pango, a library for laying out and rendering text.
Syntax:
set term wxt {<n>} {size <width>,<height>} {position <x>,<y>} {background <rgb_color>} {{no}enhanced} {font <font>} {fontscale <scale>} {title "title"} {linewidth <lw>} {dashlength <dl>} {{no}persist} {{no}raise} {{no}ctrl} {close}
Multiple plot windows are supported: set terminal wxt <n> directs the output to plot window number n.
The default window title is based on the window number. This title can also be specified with the keyword "title".
Plot windows remain open even when the gnuplot driver is changed to a different device. A plot window can be closed by pressing the letter 'q' while that window has input focus, by choosing close from a window manager menu, or with set term wxt <n> close.
The size of the plot area is given in pixels, it defaults to 640x384. In addition to that, the actual size of the window also includes the space reserved for the toolbar and the status bar. When you resize a window, the plot is immediately scaled to fit in the new size of the window. Unlike other interactive terminals, the wxt terminal scales the whole plot, including fonts and linewidths, and keeps its global aspect ratio constant, leaving an empty space painted in gray. If you type replot, click the replot icon in the terminal toolbar or type a new plot command, the new plot will completely fit in the window and the font size and the linewidths will be reset to their defaults.
The position option can be used to set the position of the plot window. The position option only applies to the first plot after the set term command.
The active plot window (the one selected by set term wxt <n>) is interactive. Its behaviour is shared with other terminal types. See mouse for details. It also has some extra icons, which are supposed to be self-explanatory.
This terminal supports an enhanced text mode, which allows font and other formatting commands (subscripts, superscripts, etc.) to be embedded in labels and other text strings. The enhanced text mode syntax is shared with other gnuplot terminal types. See enhanced for more details.
<font> is in the format "FontFace,FontSize", i.e. the face and the size comma-separated in a single string. FontFace is a usual font face name, such as 'Arial'. If you do not provide FontFace, the wxt terminal will use 'Sans'. FontSize is the font size, in points. If you do not provide it, the wxt terminal will use a size of 10 points.
For example : set term wxt font "Arial,12" set term wxt font "Arial" # to change the font face only set term wxt font ",12" # to change the font size only set term wxt font "" # to reset the font name and size
The fonts are retrieved from the usual fonts subsystems. Under Windows, those fonts are to be found and configured in the entry "Fonts" of the control panel. Under UNIX, they are handled by "fontconfig".
Pango, the library used to layout the text, is based on utf-8. Thus, the wxt terminal has to convert from your encoding to utf-8. The default input encoding is based on your 'locale'. If you want to use another encoding, make sure gnuplot knows which one you are using. See encoding for more details.
Pango may give unexpected results with fonts that do not respect the unicode mapping. With the Symbol font, for example, the wxt terminal will use the map provided by http://www.unicode.org/ to translate character codes to unicode. Pango will do its best to find a font containing this character, looking for your Symbol font, or other fonts with a broad unicode coverage, like the DejaVu fonts. Note that "the Symbol font" is to be understood as the Adobe Symbol font, distributed with Acrobat Reader as "SY______.PFB". Alternatively, the OpenSymbol font, distributed with OpenOffice.org as "opens___.ttf", offers the same characters. Microsoft has distributed a Symbol font ("symbol.ttf"), but it has a different character set with several missing or moved mathematic characters. If you experience problems with your default setup (if the demo enhancedtext.dem is not displayed properly for example), you probably have to install one of the Adobe or OpenOffice Symbol fonts, and remove the Microsoft one. Other non-conform fonts, such as "wingdings" have been observed working.
The rendering of the plot can be altered with a dialog available from the toolbar. To obtain the best output possible, the rendering involves three mechanisms : antialiasing, oversampling and hinting. Antialiasing allows to display non-horizontal and non-vertical lines smoother. Oversampling combined with antialiasing provides subpixel accuracy, so that gnuplot can draw a line from non-integer coordinates. This avoids wobbling effects on diagonal lines ('plot x' for example). Hinting avoids the blur on horizontal and vertical lines caused by oversampling. The terminal will snap these lines to integer coordinates so that a one-pixel-wide line will actually be drawn on one and only one pixel.
By default, the window is raised to the top of your desktop when a plot is drawn. This can be controlled with the keyword "raise". The keyword "persist" will prevent gnuplot from exiting before you explicitely close all the plot windows. Finally, by default the key <space> raises the gnuplot console window, and 'q' closes the plot window. The keyword "ctrl" allows you to replace those bindings by <ctrl>+<space> and <ctrl>+'q', respectively. These three keywords (raise, persist and ctrl) can also be set and remembered between sessions through the configuration dialog.
Syntax:
set terminal x11 {<n> | window "<string>"} {title "<string>"} {{no}enhanced} {font <fontspec>} {linewidth LW} {{no}persist} {{no}raise} {{no}ctrlq} {{no}replotonresize} {close} {size XX,YY} {position XX,YY} set terminal x11 {reset}
Multiple plot windows are supported: set terminal x11 <n> directs the output to plot window number n. If n is not 0, the terminal number will be appended to the window title (unless a title has been supplied manually) and the icon will be labeled Gnuplot <n>. The active window may be distinguished by a change in cursor (from default to crosshair).
The x11 terminal can connect to X windows previously created by an outside application via the option window followed by a string containing the X ID for the window in hexadecimal format. Gnuplot uses that external X window as a container since X does not allow for multiple clients selecting the ButtonPress event. In this way, gnuplot's mouse features work within the contained plot window.
set term x11 window "220001e"
The x11 terminal supports enhanced text mode (see enhanced), subject to the available fonts. In order for font size commands embedded in text to have any effect, the default x11 font must be scalable. Thus the first example below will work as expected, but the second will not.
set term x11 enhanced font "arial,15" set title '{/=20 Big} Medium {/=5 Small}'
set term x11 enhanced font "terminal-14" set title '{/=20 Big} Medium {/=5 Small}'
Plot windows remain open even when the gnuplot driver is changed to a different device. A plot window can be closed by pressing the letter q while that window has input focus, or by choosing close from a window manager menu. All plot windows can be closed by specifying reset, which actually terminates the subprocess which maintains the windows (unless -persist was specified). The close command can be used to close individual plot windows by number. However, after a reset, those plot windows left due to persist cannot be closed with the command close. A close without a number closes the current active plot window.
The gnuplot outboard driver, gnuplot_x11, is searched in a default place chosen when the program is compiled. You can override that by defining the environment variable GNUPLOT_DRIVER_DIR to point to a different location.
Plot windows will automatically be closed at the end of the session unless the -persist option was given.
The options persist and raise are unset by default, which means that the defaults (persist == no and raise == yes) or the command line options -persist / -raise or the Xresources are taken. If [no]persist or [no]raise are specified, they will override command line options and Xresources. Setting one of these options takes place immediately, so the behaviour of an already running driver can be modified. If the window does not get raised, see discussion in raise.
The option replotonresize (active by default) replots the data when the plot window is resized. Without this option, the even-aspect-ratio scaling may result in the plot filling only part of the window after resizing. With this option, gnuplot does a full replot on each resize event, resulting in better space utilization. This option is generally desirable, unless the potentially CPU-intensive replotting during resizing is a concern. Replots can be manually initiated with hotkey 'e' or the 'replot' command.
The option title "<title name>" will supply the title name of the window for the current plot window or plot window <n> if a number is given. Where (or if) this title is shown depends on your X window manager.
The size option can be used to set the size of the plot window. The size option will only apply to newly created windows.
The position option can be used to set the position of the plot window. The position option will only apply to newly created windows.
The size or aspect ratio of a plot may be changed by resizing the gnuplot window.
Linewidths and pointsizes may be changed from within gnuplot with set linestyle.
For terminal type x11, gnuplot accepts (when initialized) the standard X Toolkit options and resources such as geometry, font, and name from the command line arguments or a configuration file. See the X(1) man page (or its equivalent) for a description of such options.
A number of other gnuplot options are available for the x11 terminal. These may be specified either as command-line options when gnuplot is invoked or as resources in the configuration file ".Xdefaults". They are set upon initialization and cannot be altered during a gnuplot session. (except persist and raise)
Upon initial startup, the default font is taken from the X11 resources as set in the system or user .Xdefaults file or on the command line.
Example:
gnuplot*font: lucidasans-bold-12
A new default font may be specified to the x11 driver from inside gnuplot using
`set term x11 font "<fontspec>"`
The driver first queries the X-server for a font of the exact name given. If this query fails, then it tries to interpret <fontspec> as "<font>,<size>,<slant>,<weight>" and to construct a full X11 font name of the form
-*-<font>-<weight>-<s>-*-*-<size>-*-*-*-*-*-<encoding>
So set term x11 font "arial,15,italic" will be translated to -*-arial-*-i-*-*-15-*-*-*-*-*-iso8859-1 (assuming default encoding). The <size>, <slant>, and <weight> specifications are all optional. If you do not specify <slant> or <weight> then you will get whatever font variant the font server offers first. You may set a default enconding via the corresponding X11 resource. E.g.
gnuplot*encoding: iso8859-15
The driver also recognizes some common PostScript font names and replaces them with possible X11 or TrueType equivalents. This same sequence is used to process font requests from set label.
If your gnuplot was built with configuration option --enable-x11-mbfonts, you can specify multi-byte fonts by using the prefix "mbfont:" on the font name. An additional font may be given, separated by a semicolon. Since multi-byte font encodings are interpreted according to the locale setting, you must make sure that the environmental variable LC_CTYPE is set to some appropriate locale value such as ja_JP.eucJP, ko_KR.EUC, or zh_CN.EUC.
Example:
set term x11 font 'mbfont:kana14;k14' # 'kana14' and 'k14' are Japanese X11 font aliases, and ';' # is the separator of font names. set term x11 font 'mbfont:fixed,16,r,medium' # <font>,<size>,<slant>,<weight> form is also usable. set title '(mb strings)' font 'mbfont:*-fixed-medium-r-normal--14-*'
The same syntax applies to the default font in Xresources settings, for example,
gnuplot*font: \ mbfont:-misc-fixed-medium-r-normal--14-*-*-*-c-*-jisx0208.1983-0
If gnuplot is built with --enable-x11-mbfonts, you can use two special PostScript font names 'Ryumin-Light-*' and 'GothicBBB-Medium-*' (standard Japanese PS fonts) without the prefix "mbfont:".
In addition to the X Toolkit options, the following options may be specified on the command line when starting gnuplot or as resources in your ".Xdefaults" file (note that raise and persist can be overridden later by set term x11 [no]raise [no]persist):
The options are shown above in their command-line syntax. When entered as resources in ".Xdefaults", they require a different syntax.
Example:
gnuplot*gray: on gnuplot*ctrlq: on
gnuplot also provides a command line option (-pointsize <v>) and a resource, gnuplot*pointsize: <v>, to control the size of points plotted with the points plotting style. The value v is a real number (greater than 0 and less than or equal to ten) used as a scaling factor for point sizes. For example, -pointsize 2 uses points twice the default size, and -pointsize 0.5 uses points half the normal size.
The -ctrlq switch changes the hot-key that closes a plot window from q to <ctrl>q. This is useful is you are using the keystroke-capture feature pause mouse keystroke, since it allows the character q to be captured just as all other alphanumeric characters. The -ctrlq switch similarly replaces the <space> hot-key with <ctrl><space> for the same reason.
NB: THIS SECTION IS LARGELY IRRELEVANT IN GNUPLOT VERSION 5 The X11 terminal honors the following resources (shown here with their default values) or the greyscale resources. The values may be color names as listed in the X11 rgb.txt file on your system, hexadecimal RGB color specifications (see X11 documentation), or a color name followed by a comma and an intensity value from 0 to 1. For example, blue, 0.5 means a half intensity blue.
The command-line syntax for these is simple only for background, which maps directly to the usual X11 toolkit option "-bg". All others can only be set on the command line by use of the generic "-xrm" resource override option
Examples:
gnuplot -background coral
to change the background color.
gnuplot -xrm 'gnuplot*line1Color:blue'
to override the first linetype color.
When -gray is selected, gnuplot honors the following resources for grayscale or color displays (shown here with their default values). Note that the default background is black.
NB: THIS SECTION IS LARGELY IRRELEVANT IN GNUPLOT VERSION 5 gnuplot honors the following resources for setting the width (in pixels) of plot lines (shown here with their default values.) 0 or 1 means a minimal width line of 1 pixel width. A value of 2 or 3 may improve the appearance of some plots.
gnuplot honors the following resources for setting the dash style used for plotting lines. 0 means a solid line. A two-digit number jk (j and k are >= 1 and <= 9) means a dashed line with a repeated pattern of j pixels on followed by k pixels off. For example, '16' is a dotted line with one pixel on followed by six pixels off. More elaborate on/off patterns can be specified with a four-digit value. For example, '4441' is four on, four off, four on, one off. The default values shown below are for monochrome displays or monochrome rendering on color or grayscale displays. Color displays default to dashed:off
NB: THIS SECTION IS LARGELY IRRELEVANT IN GNUPLOT VERSION 5 Choosing the appropriate visual class and number of colors is a crucial point in X11 applications and a bit awkward, since X11 supports six visual types in different depths.
By default gnuplot uses the default visual of the screen. The number of colors which can be allocated depends on the visual class chosen. On a visual class with a depth > 12bit, gnuplot starts with a maximal number of 0x200 colors. On a visual class with a depth > 8bit (but <= 12 bit) the maximal number of colors is 0x100, on <= 8bit displays the maximum number of colors is 240 (16 are left for line colors).
Gnuplot first starts to allocate the maximal number of colors as stated above. If this fails, the number of colors is reduced by the factor 2 until gnuplot gets all colors which are requested. If dividing maxcolors by 2 repeatedly results in a number which is smaller than mincolors gnuplot tries to install a private colormap. In this case the window manager is responsible for swapping colormaps when the pointer is moved in and out the x11 driver's window.
The default for mincolors is maxcolors / (num_colormaps > 1 ? 2 : 8), where num_colormaps is the number of colormaps which are currently used by gnuplot (usually 1, if only one x11 window is open).
Some systems support multiple (different) visual classes together on one screen. On these systems it might be necessary to force gnuplot to use a specific visual class, e.g. the default visual might be 8bit PseudoColor but the screen would also support 24bit TrueColor which would be the preferred choice.
The information about an Xserver's capabilities can be obtained with the program xdpyinfo. For the visual names below you can choose one of StaticGray, GrayScale, StaticColor, PseudoColor, TrueColor, DirectColor. If an Xserver supports a requested visual type at different depths, gnuplot chooses the visual class with the highest depth (deepest). If the requested visual class matches the default visual and multiple classes of this type are supported, the default visual is preferred.
Example: on an 8bit PseudoColor visual you can force a private color map by specifying gnuplot*maxcolors: 240 and gnuplot*mincolors: 240.
By default the contents of the current plot window are exported to the X11 clipboard in response to X events in the window. Setting the resource 'gnuplot*exportselection' to 'off' or 'false' will disable this.
By default text rotation is done using a method that is fast, but can corrupt nearby colors depending on the background. If this is a problem, you can set the resource 'gnuplot.fastrotate' to 'off'
The xlib terminal driver supports the X11 Windows System. It generates gnuplot_x11 commands, but sends them to the output file specified by set output '<filename>'. set term x11 is equivalent to set output "|gnuplot_x11 -noevents"; set term xlib. xlib takes the same set of options as x11.