[Top] [Prev] [Next] [Bottom]

3.1 Device Control

3.1.1 Window Control

Calling Sequences

window ( [n] [, <keylist>])
winkill ( [n])
n = current_window ()
fma()

Description

The window function selects device n as the current graphics device. n may range from 0 to 7, inclusive. Each graphics device corresponds to an X window, a hardcopy file, or both, depending on the values of the keyword arguments described below. If n is omitted, it defaults to the current active device, if any. window returns the number of the currently active device. winkill deletes the current graphics device, or device n if n is specified. current_window returns the number of the current active device, or -1 if there is none. fma frame advances the current graphics device. The current picture remains displayed in the associated X window (if any) until the next element is actually plotted. An fma must be given after the last plot to a hardcopy file for that plot to appear when the file is printed.

The keywords accepted by the window function are

display, dpi, dump, hcp, legends, private, style, wait

and are described in the next subsection.

Keyword Arguments

The following keyword arguments can be specified with this function.

display

A string of the form "host:server.screen" which tells where the X window will appear (for example, "icf.llnl.gov:0.0"). If not specified, uses your default display (which it gets from your DISPLAY environment variable). Use display = "" (the null string) to create a graphics device which has no associated X window. (You should do this if you want to make plots in a non-interactive batch mode.)

dpi

The allowed values for dpi are 75 and 100. The X window will appear on your default display at 75 dpi, unless you specify the display and/or dpi keywords. A dpi = 100 X window is larger than a dpi = 75 X window; both represent the same thing on paper.

dump

The dump keyword, if present, controls whether all colors are converted to a gray scale (dump = 0, the default), or the current palette is dumped at the beginning of each page of hardcopy output. Set dump to 1 if you are doing color plots. The dump keyword applies only to the specific hardcopy file defined using the hcp keyword (see below) -- use the dump keyword in the hcp_file command to get the same effect in the default hardcopy file.

hcp

The value of this keyword is a quoted string giving a file name. By default, a graphics window does NOT have a hardcopy file of its own -- any requests for hardcopy are directed to the default hardcopy file, so hardcopy output from any window goes to a single file. By specifying the hcp keyword, however, a hardcopy file unique to this window will be created. If the hcp filename ends in ``.ps'', then the hardcopy file will be a PostScript file; otherwise, hardcopy files are in binary CGM format. Use hcp = "" (the null string) to revert to the default hardcopy file (closing the window specific file, if any).
In the next section of this manual we shall consider the hardcopy and file functions. Note that the PyGist default is to write to a hardcopy file only on demand. (See function hcp, page 20.)

legends

The legends keyword, if present, controls whether the curve legends are (legends = 1, the default) or are not (legends = 0) dumped to the hardcopy file. The legends keyword applies to all pictures dumped to hardcopy from this graphics window. Legends are never plotted to the X window.

private

By default, an X window will attempt to use shared colors, which permits several PyGist graphics windows (including windows from multiple instances of Python) to use a common palette. You can force an X window to post its own colormap (set its colormap attribute) with the private = 1 keyword. You will most likely have to fiddle with your window manager to understand how it handles colormap focus if you do this. Use private = 0 to return to shared colors.

style

The style keyword, if present, specifies (as a quoted string) the name of a Gist stylesheet file; the default is "work.gs". The style sheet determines the number and location of coordinate systems, tick and label styles, and the like. Here are brief descriptions of the available stylesheets:

axes.gs: axes with labeled tick marks along bottom and left of graph.

boxed.gs: lines all the way around the plot with tick marks, labeled along bottom and left.

boxed2.gs: same as boxed.gs but no tick marks on the top and right sides.

l_nobox.gs: no box, axes, or ticks; graph extends all the way to edge of window.

nobox.gs: indistinguishable from l_nobox.gs.

vg.gs: large tick marks all the way around the graph, but no lines, with large infrequent labels on the bottom and left.

vgbox.gs: same as vg.gs except with lines all the way around as well

work.gs: small tick marks with small, frequent labels on bottom and left, no lines.

work2.gs: similar to work.gs, but no ticks along top and right.

wait

By default, Python will not wait for the X window to become visible. Code which creates a new window, then plots a series of frames to that window should use wait = 1 to assure that all frames are actually plotted.

Examples

The first example ensures that an old window 0 is not hanging around, and then creates a new 100 dpi window.

winkill(0)
window (0, wait = 1, dpi = 100)

The second example changes the style sheet of window 2.

window (2, style = "vgbox.gs")

3.1.2 Hard Copy and File Control

Calling Sequences

eps (name)
hcp ()
hcp_file ( [filename] [, dump = 0/1])
filename = hcp_finish ( [n])
hcp_out ( [n] [, keep = 0/1])
hcpon ()
hcpoff ()

Descriptions

eps (name)

Write the picture in the current graphics window to the Encapsulated PostScript file name + ".epsi" (i.e., the suffix .epsi is added to name). The eps function requires the ps2epsi utility which comes with the project GNU Ghostscript program. Any hardcopy file associated with the current window is first closed, but the default hardcopy file is unaffected. As a side effect, legends are turned off and color table dumping is turned on for the current window. The environment variable PS2EPSI_FORMAT contains the format for the command to start the ps2epsi program.

hcp ()

The hcp function sends the picture displayed in the current graphics window to the hardcopy file. (The name of the default hardcopy file can be specified using hcp_file; each individual graphics window may have its own hardcopy file as specified by the window function.)

hcp_file ( [filename] [, dump = 0/1])

Sets the default hardcopy file to filename. If filename ends with ``.ps'', the file will be a PostScript file, otherwise it will be a binary CGM file. By default, the hardcopy file name will be ``Aa00.cgm'', or ``Ab00.cgm'' if that exists, or ``Ac00.cgm'' if both exist, and so on. The default hardcopy file gets hardcopy from all graphics windows which do not have their own specific hardcopy file (see the window function). If the dump keyword is present and non-zero, then the current palette will be dumped at the beginning of each frame of the default hardcopy file. This is what you want to do when you want color plots. With dump = 0, the default behavior of converting all colors to a gray scale is restored.

filename = hcp_finish ( [n])

Close the current hardcopy file and return the filename. If n is specified, close the hcp file associated with window n and return its name; use hcp_finish (-1) to close the default hardcopy file.

hcp_out ( [n] [, keep = 0/1])

**** NOT YET IMPLEMENTED ****
Finishes the current hardcopy file and sends it to the printer. If n is specified, prints the hcp file associated with window n; use hcp_out (-1) to print the default hardcopy file. Unless the keep keyword is supplied and non-zero, the file will be deleted after it is processed by gist and sent to lpr.

hcpon ()

The hcpon function causes every fma (frame advance) function call to do an implicit hcp, so that every frame is sent to the hardcopy file.

hcpoff ()

The hcpoff command reverts to the default ``demand only'' mode.


[Top] [Prev] [Next] [Bottom]

support@icf.llnl.gov
Copyright © 1997,Regents of the University of California. All rights reserved.