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

POSTSCRIPT

Name:
    POSTSCRIPT
Type:
    Output Device Command
Purpose:
    Direct graphical output to a POSTSCRIPT device.
Description:
    Postscript is a device independent page description language supported by various vendors. Although Postscript is primarily used by printers, it can be used by other types of devices (e.g., film recorders) as well. Note that Postscript is a complete language as opposed to a simple device protocol. The Postscript file is an ASCII file containing Postscript commands. To render a Postscript file on a specific device, one of the following methods is used

    1. A specific device may have built-in support for Postscript files. Typically, this is provided by a vendor written driver. In this case, the Postscript file can be sent directly to the device.

    2. If the device does not support Postscript directly, a Postscript translator may be available that allows you to view or print the Postscript file on a non-Postscript device. One example of this is the ghostview/ghostscript software. Ghostscript is the underlying Postscript translator while Ghostview is a GUI program that allows you to view the Postscript file on the screeen and to print the Postscript file on a non-Postscript printer. Other translators/viewers are available.

    Postscript is routinely supported in the Linux environment for printers. In the Windows environment, it is more common to use Ghostview (or some other Postscript translator) to send Postscript files to a printer.

    Postscript is the most commonly used format in Dataplot for printing graphics.

    Many word processing and page publishing programs import Postscript files thereby allowing graphics generated by other programs to be to be embedded with text. However, they normally require that the Postscript file be in a special format called encapsulated Postscript. The primary difference between encapsulated Postscript and standard Postscript is that encapsulated Postscript assumes that each graph is in a separate file while standard Postscript can contain multiple pages in the same file. In order to generate encapsulated Postscript in Dataplot, you would typically do something like the following

      SET IPL1NA PLOT1.EPS
      DEVICE 2 POSTSCRIPT ENCAPSULATED
      ... Generate first plot ..
      DEVICE 2 CLOSE
      .
      SET IPL1NA PLOT2.EPS
      DEVICE 2 POSTSCRIPT ENCAPSULATED
      ... Generate second plot ..
      DEVICE 2 CLOSE

    The SET IPL1NA command is used to give the plot file a unique name. This basic sequence can be repeated as often as needed.

    Postscript is closely related to the Portable Document Format (PDF). PDF is essentially a binary form of Postscript.

Syntax 1:
    POSTSCRIPT

    This form designates device 1 (the terminal) as a Postscript device.

Syntax 2:
    POSTSCRIPT ENCAPSULATED

    This form designates device 1 (the terminal) as an encapsulated Postscript device.

Syntax 3:
    DEVICE <1/2/3> POSTSCRIPT

    This form designates one of DATAPLOT's 3 devices (it will typically be device 2) as a Postscript device.

Syntax 4:
    DEVICE <1/2/3> POSTSCRIPT ENCAPSULATED

    This form designates one of DATAPLOT's 3 devices (it will typically be device 2) as an encapsulated Postscript device.

Examples:
    POSTSCRIPT
    DEVICE 2 POSTSCRIPT
    DEVICE 3 POSTSCRIPT
    DEVICE 2 POSTSCRIPT ENCAPSULATED
Note:
    The Postscript driver can support either color or monochrome Postscript devices. The default is monochrome. Enter a DEVICE COLOR ON command after the POSTSCRIPT command to get color. Postscript supports the full range of color and gray scale provided for in DATAPLOT. Enter HELP COLOR for a list of available colors and gray scales. Colors can have a different appearance on different Postscript devices. Specifically, Postscript color printers can come with 1 bit, 4 bits. or 8 bits for each of 3 colors. The output quality will vary significantly depending on the number of bits used.

    Monochrome Postscript devices do support gray scale. Be aware that they do it by "dithering" since each pixel is either on or off. Dithering means that gray scale is emulated by turning some proportion of neighboring pixels on or off to get the desired effect.

    If you want to make color on the default, enter the command (you may want to put this in your dplogf.tex startup file)

    This command is particularly useful for DEVICE 3 output since Dataplot performs the opening and closing of this device in the background without user intervention.

Note:
    One of Postscript's strengths is the availability of scalable and rotatable typeset quality fonts. Postscript fonts (for hardware generated characters) can be specified with the following command:

      SET POSTSCRIPT FONT <font id>

    The available fonts (34 are currently supported) can be shown with the following command:

    The default font is Helvetica Bold.

Note:
    Postscript fonts are only used when hardware characters are generated. This means that Greek characters and other special symbols are not available with the Postscript fonts. The exception is that the SP(), CR(), LC(), and UC() options are supported for hardware fonts.

    Greek characters (and a few other special symbols) can be generated by using the symbol font (SET POSTSCRIPT FONT SYMBOL). In this case, a Greek alpha is obtained by entering TEXT LC()A rather than TEXT LC()ALPH(). The limitation is that only one Postscript font can be active for a plot, so text strings that require a mixture of standard and Greek characters are not practical with this method. DATAPLOT does not support automatically switching to the symbol font when a Greek character (e.g., ALPH(), BETA()) is encountered in the text string.

    At this time, if you have text strings which consist only of Greek characters you can use the symbol font. However, if your string is a mixture of standard and Greek characters, you need to use one of the software fonts.

    NOTE 5/2009:

    The Postscript device was upgraded to handle most of Dataplot's supported special characters. These special characters are mapped to the Postscript symbol font. There is not a 1-to-1 correspondence between Dataplot's special characters and the symbols available in the Postscript symbol font. The supported symbols below are ones that are available in both the Dataplot special symbol set and the Postscript symbol font. Note that this means you can mix these Greek characters and special symbols with regular text without setting the SYMBOL font.

    Specifically, the following are supported:

    1. subscripts and superscripts

    2. Greek characters

    3. A subset of the mathematical symbols and other special characters. The following is the list of Dataplot special characters that will be translated to equivalent characters in the Postscript symbol font:

        INTE(), SUMM(), PROD(), INFI(), DOTP(),
        DEL(), DIVI(), LT(), GT(), LTEQ(), GTEQ(),
        NOT(), +-(), APPR(), TILD(), EQUI(), VARI(),
        CARA(), TIME(), PART(), RADI(), SUBS(),
        SUPE(), UNIO(), INTR(), ELEM(), THEX(),
        THFO(), RAPO(), LBRA(), RBRA(), LCBR(),
        RCBR(), LELB(), RELB(), RARR(), UARR(),
        DARR(), VBAR(), HBAR(), DEGR()

      The full set of special symbols supported by Dataplot is documented in chapter 13 of Volume I of the Reference Manual

      http://www.itl.nist.gov/div898/software/dataplot/refman1/ch13/homepage.pdf

Note:
    Postscript printers on most systems require that the first line start with a "%!". However, a few require that it start with " %!". The default in DATAPLOT is no leading space. If your system requires this (i.e, if the Postscript output is printed as text rather than a graph), enter the following command:

      SET POSTSCRIPT SPACE ON

    Note that while this was an issue with some early Postscript devices, with current Postscript devices this should no longer be an issue.

Note:
    Landscape or portrait orientation can be set via the ORIENTATION command. It can be toggled as many times as desired in a DATAPLOT session. The default is landscape orientation.
Note:
    The following SET commands can be used to specify the margins and resolution of the particular Postscript printer (these should normally not be required):

    • SET POSTSCRIPT PPI <number> sets the resolution (in points per inch). The default is 300.

    • SET POSTSCRIPT [LANDSCAPE/PORTRAIT] LEFT MARGIN sets the left margin (in dots). The default is 50.

    • SET POSTSCRIPT [LANDSCAPE/PORTRAIT] RIGHT MARGIN sets the right margin (in dots). The default is 50.

    • SET POSTSCRIPT [LANDSCAPE/PORTRAIT] BOTTOM MARGIN sets the bottom margin (in dots). The default is 50.

    • SET POSTSCRIPT [LANDSCAPE/PORTRAIT] TOP MARGIN sets the top margin (in dots). The default is 50.

    You can also use the WINDOW CORNER COORDINATES command to set the margin, but this affects all the active devices.

Note:
    Display Postscript is a special version of Postscript for terminals and workstations. The standard Postscript driver does not work for these devices. Display Postscript does not currently seem to be of much interest.
Note:
    Some tweaks were made to the Postscript device 1/2003.

    1. Previously, Dataplot started a new page when the device was intialized. It also started a new page when the first plot was generated. This was to ensure that a fresh page was started if you were generating diagrammatic graphics before the first plot. However, it caused a blank page to be printed for most applications. Dataplot now automatically keeps track so that the first plot will not generate the unneeded page erase.

    2. Previously, the LANDSCAPE WORDPERFECT orientation (this results in a landscape orientation on a portrait page) was supported for encapsulated Postscript, but not for regular Postscript. This orientation is now supported for regular Postscript.

    3. Dataplot allows you to switch between the various orientations (LANDSCAPE, PORTRAIT, LANDSCAPE WORDPERFECT, SQUARE) when using Postscript. For this reason, it sets the bounding box for an 11x11 inch page.

      The following command

      can be used to modify this behavior. If the value is FLOAT (the default), the bounding box is set for an 11x11 inch page. If the value is set to FIXED, the bounding box will be set according to whatever the current orientation is when the device is initialized. However, you should not change the orientation if FIXED is used.

      If you are simply using the Postscript output for printing, then you do not need to worry about this command. However, it may occasionally be useful if are importing the Postscript output into an external program.

Note:
    In addition to Dataplot's native Postscript driver, you can also generate Postscript output using

      DEVICE 2 LIBPLOT POSTSCRIPT
      DEVICE 2 CAIRO POSTSCRIPT

    Libplot and Cairo are graphics libraries that support a number of different graphics devices.

Note:
    The 2023/11 version of Dataplot was updated to allow you to control the appearance of dashed and dotted lines. Dash patterns are given by a series of pairs of integer values. The first gives the number of units drawn as a solid line and the second gives the number of units drawn as a blank line. These units are specified in Postscript 72 points per inch units (e.g., 2 means 2 points or 2/72 of an inch).

    The defaults are:

      dotted line: 2 4
      dashed line: 4 4
      da1 line: 4 2
      da2 line: 6 4 2 4
      da3 line: 6 4 6 4
      da4 line: 6 4 4 4 2 4
      da5 line: 6 4 2 4 2 4

    To change the defaults, you can enter the commands

      SET POSTSCRIPT DOTTED LINE <list of values>
      SET POSTSCRIPT DASHED LINE <list of values>
      SET POSTSCRIPT DA1 LINE <list of values>
      SET POSTSCRIPT DA2 LINE <list of values>
      SET POSTSCRIPT DA3 LINE <list of values>
      SET POSTSCRIPT DA4 LINE <list of values>
      SET POSTSCRIPT DA5 LINE <list of values>

    Up to 10 pairs of points can be specified. To reset the default, enter the command with no arguments (or use DEFAULT as the only argument).

    There are corresponding PROBE commands that display the current values.

Note:
    The ghostscript program can be used to convert Postscript to Portable Document Format (PDF) or to other formats such as JPEG. The SET POSTSCRIPT CONVERT command can be used to allow this to be done automatically (i.e., when a Postscript file is closed, a PDF version will automatically be created). Independently of Dataplot, you can enter the command

      ps2pdf <postscript file name>

    This creates a file with same base name but an extension of "pdf" in PDF format.

    The open source GIMP program can be used to convert Dataplot postscript/PDF files to various popular image formats such as JPEG or PNG. This can be useful if you want to import the Postscript file into a word processing program such as Word. Note that there a number of other programs (both open source and commercial) that can convert Postscript files to image formats. We do not endorse any specific program for this purpose, but it should be noted that better results are usually obtained if the program performs anti-aliasing when converting the Postscript file to a bit-map format.

Default:
    Postscript is the default for the DEVICE 3 output.
Synonyms:
    DEVICE 2 EPS is a synonym for DEVICE 2 POSTSCRIPT ENCAPSULATED
    SET POSTSCRIPT DEFAULT COLOR is a synonym for
                SET POSTSCRIPT COLOR DEFAULT
DEVICE NOTES
    1. HARDWARE TEXT - Postscript hardware characters can be scaled to any size. Vertical strings are rotated 90 degrees. There are 34 typeset fonts that can be selected. Postscript fonts are of publication quality.

    2. COLOR - Postscript devices are treated as black and white by default (although they do support gray scale). To activate color, enter DEVICE 2 COLOR ON after the DEVICE 2 POSTSCRIPT command. Postscript supports the full range of DATAPLOT colors. The appearance of a specific color can vary depending on the device.

    3. HARDWARE FILL - Area fills are generated in hardware.
    4. DASH PATTERNS - The Postscript driver supports unique dash patterns for DASH, DOT, DASH2, DASH3, and DASH4. DASH5 is the same as DASH4.

    5. LINE WIDTH - Thick lines are generated in hardware.

    6. GRAPHICS INPUT - The CROSS-HAIR command is ignored for this device.
Related Commands:
    CAIRO = Generate graphics using the Cairo library.
    LIBPLOT = Generate graphics using the libplot library.
    HPGL = Direct graphical output to an HPGL device.
    TEKTRONIX = Direct graphical output to a Tektronix device.
    X11 = Direct graphical output to an X11 device.
    DEVICE = Specify certain actions for the graphics output.
    SHOW COLOR = Show the available colors on the Postscript device.
    SET POSTSCRIPT CONVERT = Automatically convert Postscript output to a specified format when the Postscript device is closed.
    PSVIEW = View the most recent plot in a Postscript viewer.
Applications:
    Graphics Output
Implementation Date:
    1989/02
    1989/06: Support for SET POSTSCRIPT FONT
    2003/01: Better handling of first page so a blank page will
                    not be generated
    2003/01: Support for SET POSTSCRIPT BOUNDING BOX
    2003/01: LANDSCAPE WORDPERFECT orientation supported for
                    regular Postscript
    2004/06: Support for SET POSTSCRIPT COLOR DEFAULT
    2009/05: Automatic support (i.e., SYMBOL font does not need to be
                    set) for Greek characters and certain special symbols
    2023/11: Support for controlling appearance of dashed/dotted lines
Program:
     
    DEVICE 2 POSTSCRIPT
    PLOT X**2 FOR X = 1 1 9
    DEVICE 2 CLOSE
        
Date created: 11/07/2017
Last updated: 11/03/2023

Please email comments on this WWW page to alan.heckert@nist.gov.