SED navigation bar go to SED home page go to Dataplot home page go to NIST home page SED Home Page SED Staff SED Projects SED Products and Publications Search SED Pages
Dataplot Vol 1 Vol 2


    Output Device Command
    Create LaTeX format graphics files.
    Tex is a powerful typesetting program originally developed by Donald Knuth. LaTeX was developed by Leslie Lamport and is a program written on top of Tex. LaTeX provides access to the power of Tex, but with a simpler command language.

    The motivation for developing a LaTeX graphics driver in Dataplot is to help in producing publication quality graphics with Dataplot. Additional comments on utilizing the typesetting capabilities of LaTeX from within Dataplot are given below.

    The basic process in using LaTeX is:

    1. Create an ASCII text file with a ".tex" file extension that contains the desired text along with the LaTeX formatting commands.

    2. Run the "latex" command on this file to create a device indpendent file (called a DVI file).

    3. Run a driver program to generate the DVI file for a specific device. For example, on Unix platforms the command "dvips" is typically run to generate a Postscript from the DVI file.

      Note that LaTeX provides a "special" mechanism to take advantage of features specific to a given output device. It is up to the DVI driver program to implement these "special" options.

    Although Tex and LaTeX were written primarily for typesetting text, there are several ways that LaTeX provides for graphics:

    1. LaTeX supports a "picture" environment that provides some capabilites for graphics in the LaTeX language.

      This environment has some serious limitations (e.g., no direct color support, lines can only be drawn at a fairly limited number of slopes).

      In order to overcome these limitations, a number of "add-on" packages have been written to enhance the picture environment. These packages may implement some of their capabilites in LaTeX (which will be available on all supported devices) and others using "special" features of a DVI driver (these may not be available on some devices).

      The Dataplot LaTeX graphics driver uses the LaTeX picture environment along with the following packages:

      1. epic
      2. eepic
      3. graphics

      If your local LaTeX installation does not already have these add-on packages available, then you need to download and install them (they are freely downloadable).

    2. The "epsfig" package can be used to import Postscript graphics. Dataplot Postscript graphics can be incorporated into LaTeX documents in this way. In particular, the SET POSTSCRIPT CONVERT and CAPTURE LATEX commands can be used to automate this in Dataplot (enter HELP CAPTURE LATEX for details).

    Dataplot supports LaTeX output in three ways:

    1. You can generate a "standalone" LaTeX file. You can run the latex command on this file to generate the desired graph.

    2. You can generate a file without the LaTeX preamble and postamble commands. This is useful if you want to import the graphics into an already existing LaTeX file.

    3. You can use the CAPTURE LATEX option to create a LaTeX file that has both the alphanumeric output and the graphics generated by Dataplot in a single file.

    Features of the LaTeX driver are discussed in the Notes section below.

Syntax 1:

    This syntax is used to generate a standalone LaTeX file.

Syntax 2:

    This syntax is used to generate a LaTeX file that can be imported into another LaTeX file (i.e., you can not run the latex command directly on this file).

Syntax 3:

    This syntax is used in conjunction with the CAPTURE LATEX command to incorporate Dataplot alphanumeric and graphics output in a single LaTeX file. The Program 2 example below gives an example of this.

    One of the primary reasons for using the laTeX graphics driver is to obtain publication quality text on your graphs.

    In particular, this applies to special characters such as subscritps, superscripts, Greek characters, and special mathematical symbols. If your text does not utilize these, you can obtain publication quality text by simply using the Postscript driver.

    There are two ways to utilize these special symbols.

    1. Dataplot provides a mechanism for software fonts to generate special symbols. A list of supported symbols can be found at

      For example, alph() will generate a Greek alpha.

      The LaTeX driver will convert these Dataplot codings for special symbols to the corresponding LaTeX codings.

      A few notes on this:

      • For Greek characters, use LC() and UC() to specify lower case and upper case, respectively (the default is upper case).

      • A few symbols are currently not translated:

        VARI() - VARIES
        THFO() - THEREFORE
        LELB() - LEFT ELBOW
        RELB() - RIGHT ELBOW

    2. Alternatively, you can put the appropriate LaTeX code in the text yourself. For example, to put an alpha squared in a title, enter the following:

        TITLE $\alpha^{2}$

      The "$" symbol is used to specify LaTeX math mode (you need to be in math mode for LaTeX to properly interpert the special symbols). By default, Dataplot uses the "^" to denote replacement of parameters and strings in Dataplot commands. If your LaTeX codings use superscripts, then you need to modify the Dataplot replacement character before any commands that use "^" to specify superscripting to LaTeX.

      The primary advantage of this method is that it gives you full access to the LaTeX special symbol library. This library is extensive and contains many characters not currently supported in Dataplot. In addition, you can do things such as generating bold or italic text.

      The primary disadvantage is that Dataplot does no error checking of the text you enter. It is simply passed to the LaTeX file as entered. If you have non-matching braces or dollar signs, your LaTeX file may not compile when you run the latex command.

    In standalone mode, Dataplot will generate an appropriate preamble at the beginning of the LaTeX file and a postamble at the end of the LaTeX file.

    If you want to provide your own preamble or postamble, you can enter the following command:


    The header file should contain the following two lines:

    The generated LaTeX file is an ASCII file. If you have some proficiency in LaTeX, you can modify the LaTeX output using a text editor. For example, you may want to have LaTeX load a different font (Dataplot uses the default LaTeX font). If you entered a LaTeX text coding incorrectly, you can simply fix it in the generated LaTeX file without rerunning the Dataplot code that created the LaTeX file.
    By default, the LaTeX graphic file is generated without color. In order to activate color, enter the following command before the DEVICE <1/2> LATEX command:

    Thick lines can be generated either by LaTeX or by Dataplot. LaTeX supports 3 distinct line thickneses.

    To have LaTeX generate thick lines, enter


    To have Dataplot generate thick lines, enter

    Dataplot currently creates the LaTeX graphics at 300 dots per inch. It assumes a page size with a width of 6.5 inches and a height of 9 inches.

    Currently, Dataplot does not support different dots per inch.

    If you specify ORIENTATION LANDSCAPE or ORIENTATION LANDSCAPE WORDPERFECT, the graph will be generated with a width of 6.25 inches and a height of 4.8 inches (i.e., a landscape orientation on a portrait page). If you specify ORIENTATION PORTRAIT, the graph will be generated with a width of 6.26 inches and a height of 9 inches. If you specify ORIENTATION SQUARE, the graph will be generated with a width of 6 inches and a height of 6 inches. Dataplot does not currently support a true landscape mode (i.e., a rotated picture with a width of 9 inches and a height of 6.25 inches).

    You can also specify your own dimensions. For example, to generate a 5 inch by 5 inch plot, enter the commands

      LET AWIDTH = 5.0*300

    If you use the default landscape mode, you may want to specify larger character sizes. Dataplot text sizes are specified as a percentage of the height and generating a landscape mode plot may result in the default character sizes being smaller than desired. You may want to include the following size commands:

      HEIGHT 3
      TITLE SIZE 3
      LABEL SIZE 3

    The default character size for the above commands is 2.

    Note that Dataplot cannot specify a specific point size for text to LaTeX. Instead, there are 10 commands (e.g., \normalsize, \footnotesize, \tiny, \large). The actual size LaTeX generates depends on the font and the default point size for the LaTeX file. Dataplot maps the requested character size to one of the 10 LaTeX size commands based on a default point size of 12 and the default LaTeX font. Our testing shows that this results in 5 distinct point sizes generated by LaTeX.

    If you use a different font, Dataplot's best guess as to the size LaTeX will generate may not be accurate. Since Dataplot uses LaTeX to justify text, this should typically not be a problem. One case where it might be an issue is in the placement of tick mark labels. You can use the TIC MARK LABEL DISPLACEMENT comamnd to adjust their positioning if needed.

    Typically, you want LaTeX files to have a ".tex" file extension. You can do something like the following to modify the default plot file name:

      SET IPL1NA plot1.tex
    The CAPTURE LATEX command will generate the output from Dataplot analysis commands in LaTeX format. This feature is partially implemented. For commands that have not been implemented, the Dataplot output will be enclosed in the "verbatim" environment. Enter HELP CAPTURE LATEX for a list of commands that will generate LaTex specific output and for details on the use of this command.

    You can combine this with the DEVICE 1 LATEX command to generate a LaTeX file with both the analysis output and the graphics output in the same file. A typical sequence of commands would be

      CAPTURE LATEX sample.tex
      ... analysis and graphics commands ...

    Note that the order of the commands matters here. Specifically, the CAPTURE LATEX command should be entered before the DEVICE 1 LATEX command and the DEVICE 1 CLOSE command should be entered before the END OF CAPTURE command. If this sequence is not followed, some of the needed LaTeX commands may not be written to the LaTeX file.

    Even if you would like to import a presentation quality graph into Word, WordPerfect, or some other Windows-based word proceser, the LaTeX driver can still be useful.

    The steps involved are:

    1. Use the DEVICE 2 LATEX STANDALONE to generate a LaTex file.

    2. Use the latex and dvips commands to create a Postscript file of the graph.

    3. Import this Postscript graph into the Windows version of Ghostview (which you should have typically installed when installing the Windows version of Dataplot). Use the Convert menu under the File menu to convert the graph into a format that can be imported by Word (or whatever word processer you are using). The JPEG format should be supported in most cases. The Convert menu will allow you to preserve the 300 dot per inch resolution.

    4. Import the resulting JPEG format graph into Word in the standard way.

    This does require that LaTeX (and the epic and eepic packages) be installed on your local platform.

Related Commands:
    CAPTURE LATEX = Direct alphanumeric output to a file in LaTeX format.
    POSTSCRIPT = Create graphical output in Postscript format.
    SVG = Create graphical output in SVG (Scalable Vector Graphics) format.
    DEVICE Specify certain actions for the graphics output.
    Leslie Lamport (1994), "LaTEX: A Document Preparation System," Second Edition, Addison-Wesley.

    Frank Mittelbach and Michel Goosens with Johannes Braams, David Carlisle, and Chris Rowley (2004), "The LATEX Companion," Second Edition, Addison-Wesley,

    Helmut Kopka and Patrick Daly (2003), "Guide to LATEX," Fourth Edition, Addison-Wesley,

    Publication Quality Graphics
Implementation Date:
    2006/2: Original Implementation
Program 1:
    .  Demonstrate following features of Latex driver:
    .  1) Color
    .  2) Text using Latex encodings
    .  3) Text using Dataplot encodings
    .  4) Thick lines
    set ipl1na latex1.tex
    set latex color on
    device 2 latex standalone
    skip 25
    read berger1.dat y x
    quadratic fit y x
    title case asis
    label case asis
    legend case asis
    title size 3
    legend size 3
    label size 3
    tic mark label size 3
    title offset 2
    replacement character !
    .  Use Latex encodings for title
    title Y = $\alpha_{0} + \alpha_{1}x + \alpha_{2}x^{2}$
    replacement character ^
    y1label Measured In-Field Defect Size
    x1label Measured In-Lab Defect Size
    .  Use Dataplot encodings for legends
    legend 1 lc()alph()sub()0unsb() = ^a0
    legend 2 lc()alph()sub()1unsb() = ^a1
    legend 3 lc()alph()sub()2unsb() = ^a2
    tic offset units screen
    tic offset 3 3
    title size 3
    tic mark label size 3
    label size 3
    char x blank
    character color red all
    line blank solid
    line color blue all
    line thickness 0.2
    plot y pred vs x
    device 2 close
    system latex plot1.tex
    system dvips plot1

    View the output in Postscript format

    View the output in PDF format

Program 2:
    .  Example of creating Dataplot output in a single
    .  Latex file (i.e., both graphics and alphanumeric output
    .  Step 1: Read Data
    skip 25
    read stutz86.dat y1 to y5 x
    .  Step 2: Generate the Consensus Means Output
    feedback off
    capture latex  consensus.tex
    tabulate mean y1 x
    tabulate sd y1 x
    consensus mean y1 x
    .  Step 3: Generate Some Complementary Graphics
    device 1 latex
    multiplot corner coordinates 2 2 98 98
    multiplot 2 2
    multiplot scale factor 2
    title offset 2
    title size 3
    label size 3
    tic mark label size 3
    title automatic
    tic offset units screen
    tic offset 3 3
    line blank solid
    char x blank
    mean plot y1 x
    sd plot y1 x
    character box plot
    lines box plot
    fences on
    box plot y1 x
    end of multiplot
    device 1 close
    end of capture
    system latex consensus.tex
    system dvips consensus.dvi >
    View the output in PDF format

Privacy Policy/Security Notice
Disclaimer | FOIA

NIST is an agency of the U.S. Commerce Department.

Date created: 02/27/2006
Last updated: 11/03/2015

Please email comments on this WWW page to