next up previous contents index
Next: Generating EPSF using plt Up: plt Tutorial and Cookbook Previous: Color Names

Preparing Printed Output

As illustrated throughout this book, plt can generate high-quality printed output, as well as EPS (encapsulated PostScript) files that can be included in LATEX and other documents.

plt does not include drivers for non-PostScript printers. If your printer does not accept PostScript, however, you may be able to convert plt's PostScript output to your printer's printer language using ghostscript (a high-quality PostScript interpreter freely available from ghostscript supports a wide variety of popular laser, ink-jet, and dot matrix printers, and can also convert PostScript into many popular image formats, including PNG, JPEG, TIFF (including fax formats), and PDF.

To understand how to make printed plots, a brief overview of how plt generates PostScript output may be helpful.

plt itself is a shell script that invokes a device-specific driver. Currently, these drivers are xplt, which draws into an X window created using xpltwin, and lwplt, which creates PostScript output. (The name lwplt comes from the Apple LaserWriter, which was the first commercially available PostScript printer.) Typically, you must use a command such as:

plt -T lw ... | lwcat -ps >
to generate a complete PostScript file (in this example, suitable for printing. The use of the ``-T lw'' option selects the lwplt driver. (Some users prefer to select the driver by setting the PTERM environment variable rather than by a command-line option. Use whatever method you prefer.) The postprocessor, lwcat, is a shell script included with the plt package that appends its standard input (in this case, the output of (lw)plt) to a prolog file that contains definitions for the PostScript procedures used by lwplt. The name of the prolog file, usually /usr/lib/ps/, is specified by the PROLOG variable set near the beginning of lwcat.

If you wish to print the output immediately, you may omit the -ps option and the output redirection from the lwcat command:

plt -T lw ... | lwcat

In this simplified version, the plot is immediately sent to the print spooler for printing (under Unix, GNU/Linux, or Mac OS X).

lwcat offers several other options:

-no spool the output, but don't eject the page (use this option if you wish to overlay the output with additional material produced by another program, such as troff)
-psv collect Postscript in a temporary file and view with gv (ghostscript)
-gv same as -psv (default if run from a Cygwin/bash window under MS-Windows)
-eps write EPSF (encapsulated PostScript format) to the standard output (do not spool)
-pdf write PDF to the standard output (see appendix C)
-png write PNG to the standard output (see appendix C)

Note that the output produced using -eps is only a close approximation to EPSF; it is acceptable to LATEX's epsfig package, at least.

By default, the output appears within a 6.75x6 inch window, the lower left corner of which is positioned 1 inch from the left edge and 3.5 inches from the bottom edge of the page. Additional lwcat options may be used to modify the size and location of the output:

-landscape use landscape mode (rotate plot 90 degrees counterclockwise)
-sq plot in a 6x6 inch window, 1.25 inches from the left edge and 3.5 inches from the bottom edge
-t plot in a 6.25x6.25 inch window, positioned as for -sq
-t2 plot in a 6.25x4 inch window, positioned as for -sq
-CinC plot in a 4.75x3.15 inch window, positioned as for -sq
-sq2 plot in a 4.5x5.5 inch window, 2.5 inches from the left and bottom edges
-v plot in a 7x9.5 inch window, 0.75 inches from the left and bottom edges
-v2 plot in a 7x8.5 inch window, positioned as for -v
-va4 plot in a 190x275 mm window, centered on an A4 sheet

Note the -landscape option changes the orientation of the plot, and not that of the plot window. Thus, for example, to print a landscape-format plot that covers the largest possible area on an 8.5x11 inch page, use both -landscape and -v; to cover the largest possible area on an A4 page with a landscape-format plot, use -landscape and -va4.

If none of these plot window sizes is what you want, there are several ways to define a custom plotting window for PostScript output:

  1. Use plt's -W or -w options, described earlier. (This is the only solution that works for screen plots as well as PostScript plots.)

  2. Use plt's -size option. This option is effective only when making a PostScript plot.

    -size fscl width height left-margin bottom-margin

    The fscl argument is a factor applied to the point sizes for all font groups, and is independent of the scaling applied to the plot. Thus, if fscl is 1, all text appears at the point sizes specified in the font group definitions, or the defaults. As another example, if fscl is 0.5, and the point size for the title font group is 20, the title text will be printed in 10 point type.

    The width, height, left-margin, and bottom-margin arguments are all given in units of inches (1 inch = 25.4 mm), and with reference to a portrait-format page (i.e., with the long edge vertical).

    Note that plt's -size option is intended to be used instead of lwcat's window definition options; if both are used, the -size option has no effect.

  3. Define and export the environment variables WDEF or LDEF before invoking lwcat. WDEF is a string containing 5 numbers separated by spaces. The first number is a font scaling factor, defined as for plt's -size option. The next two numbers are the x and y coordinates (in inches) of the lower left corner of the window, and the last two numbers are the x and y coordinates of the upper right corner. LDEF is defined similarly, but is used only in combination with -landscape; see the lwcat source for details.

  4. Customize lwcat, following the models of the existing window definitions. Other window options can be easily added by adding additional WDEF and LDEF settings as described in comments within lwcat.

By default, lwcat prints a single copy of the plt output. Multiple copies can be produced using the options -c2, -c3, -c4, -c5, or -c6; this will almost always be much faster than rerunning lwcat, since the PostScript is downloaded and rasterized only once when using these options. To print more than 6 copies, repeat or combine these options as needed, e.g., to print ten copies, use lwcat -c4 -c6 ... (or lwcat -c5 -c5, etc.)

next up previous contents index
Next: Generating EPSF using plt Up: plt Tutorial and Cookbook Previous: Color Names
George B. Moody (