next up previous contents index
Next: More about options Up: Getting Started with plt Previous: plt Essentials


Using plt without an X server

The X Window System is a standard component of GNU/Linux and virtually all current versions of Unix, including Mac OS X. A high-quality implementation of X is freely available for MS-Windows (Cygwin/X, from http://www.cygwin.com/); if you use MS-Windows, it will be well worth the modest effort required to download and install an X server. If you will be using plt with an X server, please skip ahead to section 2.3 below.

If you have not already installed plt, please see appendix F, beginning on page [*].

plt can generate PostScript plots, which can be printed directly on PostScript printers or (via ghostscript) on a variety of non-PostScript printers. ghostscript can also render PostScript on-screen, but this is most easily managed using a GUI wrapper such as gv, ggv, mgv, ghostview, or GSView. All of these require an X server, except that GSView can use native graphics when running on MS-Windows or OS/2. See http://www.cs.wisc.edu/ ghost/gv/ for details on these GUI wrappers for ghostscript.

When using plt without an X server running, always send the output to lwcat. There are two ways to do this:

  1. Send the output via a pipe, as in ``plt ... | lwcat''. (This is the recommended method.)

  2. Collect the output in a file, as in ``plt ... $>$output.plt'', then read the file, as in ``lwcat $<$output.plt''. Note that the output file does not contain a PostScript prolog, so it cannot be printed directly; lwcat is responsible for adding the prolog.

You can easily follow along with all of the examples in this book, which work using the PostScript driver in exactly the same way as when using the X driver, if you simply add ``| lwcat -gv'' to the end of each plt command. (You may omit ``-gv'' if you are running within a Cygwin/bash window under MS-Windows.) When you do this, the output of plt is opened in a gv or GSView window. Using gv or GSView's controls, you can save the plot as a file, print it (on any printer supported by GhostScript, not just on PostScript printers), and view it at natural or magnified scales. (Drivers for a vast range of printers are included with GhostScript; see http://www.ghostscript.com/ for a list of supported printers.)



You might reasonably wonder why lwcat is not part of plt. The reason is that the output of several plt commands can be concatenated and supplied to lwcat in a single batch to create multiple plots on a single page (see chapter 7). To do this, group the plt commands together within a pair of parentheses, separating them with newlines or semicolons; then send the output of the entire group to lwcat, either like this:

( plt data1 ... ; plt data2 ...; plt data3 ... ) | lwcat

or like this:

( plt data1 ... ; plt data2 ...; plt data3 ... ) >output.plt
lwcat <output.plt

If you are paying particularly close attention while reading the rest of this book, you may notice that plt accepts the option -T lw to specify PostScript output. If an X server is not running, this is the default, so that the -T lw option can be omitted. Furthermore, lwcat accepts the option -gv to specify that the output is to be opened using gv (GSView under MS-Windows), but this is the default if you are running plt and lwcat in a Cygwin/bash window, so that the -gv option can be omitted in this case. If you attempt to run plt and lwcat under MS-Windows in a DOS window (which is not recommended), or in some other way (also not recommended), you will need to use the -gv option explicitly.


next up previous contents index
Next: More about options Up: Getting Started with plt Previous: plt Essentials
George B. Moody (george@mit.edu)
2005-04-26