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

PSVIEW

Name:
    PSVIEW
Type:
    Support Command
Purpose:
    View the most recent plot in a Postscript viewer.
Description:
    DEVICE 3 (in file DPPL2F.DAT, the name may vary on some systems) output is closed and re-opened at the beginning of a plot command, so only the most recent plot is in the graphics file.

    This command will view this Postscript file using a Postscript viewer. This command is currently supported for Windows and Unix/Linux systems.

    For both Windows and Unix/Linux systems, the default viewer is ghostview. To specify a different viewer, enter the command

      SET POSTSCRIPT VIEWER <viewer>

    On Unix/Linux systems, <viewer> is case sensitive.

    This command is useful when you want to view the Postscript version of the plot without leaving the Dataplot session. The Postscript version of the plot is typically of higher quality than the screen version of the plot.

    The October, 2016 version of Dataplot made the following updates to this command.

    1. You can now view the contents of the DEVICE 2 output (see Syntax 2 below).

    2. You can view an arbitrary Postscript file (see Syntax 3 below).

    The December, 2019 version of Dataplot made the following updates to this command.

    1. The default Postscript viewer for Linux is "xdg-open" and the default viewer for MacOS is "open". These applications will select the default Postscript viewer for files that have a ".ps" or ".eps" extension. You can use the SET POSTSCRIPT VIEWER command to request a specific Postscript viewer.

      One issue is that the default names for DEVICE 2 and DEVICE 3 have a ".dat" extension rather than a ".ps" extension. For this reason, Dataplot added the command

        SET BACKUP VIEWER <viewer>

      The viewer specified by this command will be used when the given file name does not have a recognized extension.

    2. You can now view PDF files. To specify the application that will be used to view the PDF file, enter the command

        SET PDF VIEWER <viewer>

      The PDF VIEWER will be used when the file has a ".pdf" extension.

      The default viewer will be the Adobe Acrobat reader under Windows. For Linux systems, the default is to use "xdg-open" and for MacOS systems the default is to use "open". These applications will select the default PDF viewer for the local platform.

    3. You can now view image files (e.g., PNG, JPG and GIF files). To specify the application that will be used to view the image file, enter the command

        SET IMAGE VIEWER <viewer>

      The IMAGE VIEWER will be used when the file has a ".png", ".jpg", ".jpeg", ".gif", ".tif",".tiff", ".bmp" or ".svg" extension. There are a large number of image file extensions. When an unrecognized file extension is found, Dataplot will use the viewer specified by the SET BACKUP VIEWER command.

      For Windows, the default is to simply specify the file name and let the operating system select the appropriate application (this is determined by the "file association"). For Linux systems, the default is to use "xdg-open" and for MacOS systems the default is to use "open". These applications will select the default image viewer for the local platform based on the file extension.

    4. This command will issue the following commands before invoking the viewer application

        SET SYSTEM HIDDEN ON
        SET SYSTEM PERSIST OFF
        SET COMMAND LINE EXECUTE WAIT OFF

      Enter HELP SYSTEM for details on the effect of these commands. These settings will be reset to their previous values after the viewer is invoked.

    Although the default viewers will typically work well, you may prefer to specify the specific application to use. You can use the SET POSTSCRIPT VIEWER, SET PDF VIEWER, and SET IMAGE VIEWER commands to use specific applications rather than selecting system defaults (i.e., "xdg-open" or "open"). These commands can be added to your dplogf.tex file to make them your personal defaults.

Syntax 1:
    PSVIEW

    This syntax displays the most recent plot (i.e., the dppl2f.dat file).

Syntax 2:
    PSVIEW DEVICE 2

    This syntax displays the plots in the DEVICE 2 file (i.e., the dppl1f.dat file).

Syntax 3:
    PSVIEW <file-name>

    This syntax displays the plot or imgage specified by . An appropriate viewer (Postscript, PDF, image) is selected based on the file name extension. Dataplot does not check for the existence of the file before invoking the application.

Examples:
    SET POSTSCRIPT VIEWER evince
    PSVIEW

    SET POSTSCRIPT VIEWER ...
                "C:\Program Files\GHOSTGUM\GSVIEW32.EXE"
    PSVIEW

    PSVIEW DEVICE 2

    PSVIEW PLOTS.PS

Note:
    By default, the PSVIEW DEVICE 2 command will close the plot file before invoking the Postscript viewer. This is so that the last plot in the file is complete. However, this can be problematic if you want to generate additional plots. Specifically, you need to enter a DEVICE 2 POSTSCRIPT command to resume generating plots to this file. However, this new DEVICE 2 command will erase the files that previously existed in the file.

    There are a several possible solutions to this.

    You can request that the plot file not be close by entering the command

      SET PSVIEW FILE CLOSE OFF

    This will suppress closing the file. The disadvantage of this is that the last plot in the file may not be complete. A warning will be printed that the last file may not be complete. However, the advantage is that you can continue generating plots to the current plot file.

    Alternatively, you can do something like

      PSVIEW DEVICE 2
      SET IPL1NA PLOT_NEW.PS
      DEVICE 2 POSTSCRIPT

    The SET IPL1NA command allows you to specify the name of the plot file (this should come before the DEVICE 2 POSTSCRIPT command). The advantage of this approach is that the last plot will be complete. The disadvantage is that you will create multiple plot files.

Note:
    If a Dataplot command starts with a file name, Dataplot interprets this as a CALL command. For example, entering

      test.dp

    is equivalent to entering

      call test.dp

    Dataplot will now check the extension on the file name. Specifically if the file has a ".ps", ".PS", ".eps", ".EPS", ".jpg", ".JPG", ".jpeg", ".JPEG", ".png", ".PNG", ".gif", ".GIF", ".tif", ".TIF", ".tiff", or ".TIFF" extension, the following command will be executed

      PSVIEW <file-name>

    As discussed above, the appropriate viewer (Postscript, PDF or image) will be selected based on the file extension.

Default:
    For Linux, the default viewer is "ghostview". For Windows, the default viewer is "C:\Program Files\GHOSTGUM\GSVIEW\GSVIEW32.EXE".
Synonyms:
    SHOW is a synonym for PSVIEW
Related Commands:
    PP = Print the most recent plot.
    SET IPL1NA = Specify the name of the the plot file for DEVICE 2.
    SYSTEM = Invoke an operating system command.
    LIST = List the contents of a file.
Applications:
    Interactive Usage
Implementation Date:
    2011/09
    2016/10: Support for PSVIEW DEVICE 2
    2016/10: Support for arbitrary Postscript files
    2018/04: Added SHOW as a synonym
    2019/12: Support for PDF and image files
Program 1:
     
    .  Generate a plot and use the "evince" program (Linux) to view the
    .  Postscript version of the graph.
    .
    SET POSTSCRIPT VIEWER evince
    PLOT X**2 FOR X = 1 1 9
    PSVIEW
        
Program 2:
     
    device 2 postscript
    .
    char X
    line blank
    y1label Y
    x1label X
    title automatic
    title offset 2
    .
    plot x for x = 1 1 9
    plot x**2 for x = 1 1 9
    plot x**3 for x = 1 1 9
    .
    set psview file close off
    psview device 2
    plot x**4 for x = 1 1 9
        

Privacy Policy/Security Notice
Disclaimer | FOIA

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

Date created: 09/06/2011
Last updated: 12/30/2019

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