next up previous contents index
Next: Scripting with plt Up: plt Tutorial and Cookbook Previous: Preparing Plots for the Web

On-Screen Plots

This appendix describes how to get additional control over on-screen plots made under the X Window System. 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 If you are not using the X Window System, the features described here are not available; see appendix B for information about making PostScript plots that can be viewed or printed using GhostScript and gv or GSView.

Classic versions of plt also included screen drivers for a variety of (mostly obsolete) graphics terminals. These non-X screen drivers are available in the classic directory of the plt source distribution, but they lack support for some of the advanced features of plt; they are not described further in this book.

All of the features described in this book are available when using plt under the X Window System to make on-screen plots. (Classic versions of plt did not support text scaling and rotation, grey scale and color plotting, polygon fills, line width and style (dotted, dashed, etc.), opaque-center outline symbols, or progressive display in quickplot mode, all of which are now supported under X.)

In normal use, there is little you will need to know specifically about making screen plots; simply use plt as described throughout this book, and you will get screen plots unless you have selected PostScript output using the methods described in the previous appendix. Your plots will appear in a window named Plt Window, which you can dismiss by typing an escape character (or q, or x) into the window. If you don't dismiss the plt window, your next plot will appear in the same window; if you use the -o or -s e option, the previous contents of the window will not be erased, and you will be able to overlay plots.

The plt window can be resized (using whatever controls your window manager provides, typically by clicking and dragging the window frame using the mouse), but its contents will not be rescaled; run plt again to obtain a plot sized to fit the window.

If you would like to create a new plt window while keeping an existing one intact, use the command:


You don't need to run xpltwin to create the first plt window; plt looks to see if one exists and invokes xpltwin to create one if necessary. If two or more plt windows exist, plt draws into the most recently created one.

xpltwin accepts an optional geometry specification, using this syntax:

{\tt xpltwin} {\tt -g} {\em width}{\tt x}{\em height}{\tt +-}{\em xoff}{\tt +-}{\em yoff}}

The -g option accepts a geometry string (in the same format used by many other X applications) to specify the initial size of the window, and (if the window manager cooperates, which many do not) the window placement on the screen. The geometry string may also be specified as the value of the XPGEOMETRY environment variable; the command-line option overrides the environment variable if both are provided. If the geometry is unspecified, the window will fill one quarter of the screen, and will be centered on the screen if possible. The geometry string can also be saved as an X resource named xplt.geometry; you can save your preferred size in your .Xdefaults resource file by adding an entry such as:

xplt.geometry: 800x600

The resource is overridden by either the XPGEOMETRY environment variable or a command-line geometry string if either is set.

It is also possible to set the names of your preferred fonts in your .Xdefaults file. The defaults are:

xplt.font_h:    "-*-helvetica-medium-r-*-*-%d-*-*-*-*-*-*-*"
xplt.font_hb:   "-*-helvetica-bold-r-*-*-%d-*-*-*-*-*-*-*"
xplt.font_ho:   "-*-helvetica-medium-o-*-*-%d-*-*-*-*-*-*-*"
xplt.font_hbo:  "-*-helvetica-bold-o-*-*-%d-*-*-*-*-*-*-*"
xplt.font_hob:  "-*-helvetica-bold-o-*-*-%d-*-*-*-*-*-*-*"
xplt.font_c:    "-*-courier-medium-r-*-*-%d-*-*-*-*-*-*-*"
xplt.font_cb:   "-*-courier-bold-r-*-*-%d-*-*-*-*-*-*-*"
xplt.font_co:   "-*-courier-medium-o-*-*-%d-*-*-*-*-*-*-*"
xplt.font_cbo:  "-*-courier-bold-o-*-*-%d-*-*-*-*-*-*-*"
xplt.font_cob:  "-*-courier-bold-o-*-*-%d-*-*-*-*-*-*-*"
xplt.font_t:    "-*-times-medium-r-*-*-%d-*-*-*-*-*-*-*"
xplt.font_tr:   "-*-times-medium-r-*-*-%d-*-*-*-*-*-*-*"
xplt.font_tb:   "-*-times-bold-r-*-*-%d-*-*-*-*-*-*-*"
xplt.font_ti:   "-*-times-medium-i-*-*-%d-*-*-*-*-*-*-*"
xplt.font_tbi:  "-*-times-bold-i-*-*-%d-*-*-*-*-*-*-*"
xplt.font_tib:  "-*-times-bold-i-*-*-%d-*-*-*-*-*-*-*"
xplt.font_s:    "-*-symbol-medium-r-*-*-%d-*-*-*-*-*-*-*"

The final part of the resource name (e.g., tbi in xplt.font_tbi) indicates the font name as supplied in the F parameter of the -sf option, such as t-b-i in this example. The values attached to these names should normally be scalable font names, but with %d at the position that corresponds to the font size. You can use non-scalable fonts, or you can force a scalable font to be used only at one size by providing font names without %d. Use the xfontsel or xlsfonts utilities provided with most versions of the X Window System to see what fonts are available on your system.

The plt window can be given a name other than Plt Window by setting the value of the environment variable XPLTWIN to the name you have chosen. For example, using the Bourne or a similar shell, you can create a window named ``Power Spectrum'' and plot into it using these commands:

XPLTWIN="Power Spectrum"
export XPLTWIN
plt 0 1 -f spectrum.format

If you use csh or a similar shell, use

setenv XPLTWIN "Power Spectrum"
instead of the ``XPLTWIN=...'' and ``export XPLTWIN'' commands above.

By giving multiple plt windows different names and then changing the value of XPLTWIN, you can redirect successive plots to any of these windows in any order.

next up previous contents index
Next: Scripting with plt Up: plt Tutorial and Cookbook Previous: Preparing Plots for the Web
George B. Moody (