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

Plotters: A Brief Primer

The purpose of this chapter is to give a quick and dirty introduction on how to instantiate a Plotter object and use it. It is currently not possible to induce a Graph object to create Plotters of every conceivable type; the user who may not be satisfied with what is supplied can use this chapter to learn how to create Plotters which can be passed as the values of keyword arguments to Graph objects upon instantiation.

In general we recommend against anybody using the full capability of Plotter objects who is not on the computer science team. They are a low-level interface and require a lot of work and knowledge of low-level graphics engine intrinsics on the part of the user. If there is some capability not currently offered by Graph objects, then rather than using a Plotter, I recommend that you contact a member of the computer science team to add the capability which you desire.


# Uncomment one of the following depending on which
# graphics you are going to use (or both if you want
# both kinds of plotter)
# For a Narcisse plotter use:
# import Nar
# plN = Nar.Plotter ( [ <filename>] [, <keylist>])
# For a Gist plotter use:
# import Gist
# plG = Gist.Plotter ( [ <filename>] [, <keylist>])


The only argument to instantiate a PyNarcisse Plotter is <filename>; it is also the first argument to instantiate a PyGist Plotter. <filename> is a string which specifies plotting associated with a particular filename. PyGist and PyNarcisse differ dramatically in the meaning of this argument, as explained below.
PyGist: <filename> specifies a host where the PyGist window is to be displayed (e. g., "icf.llnl.gov:0.0"). If the argument <filename> is missing or if the user specifies " " (a single blank) as the <filename>, then PyGist will attempt to obtain the user's DISPLAY environment variable; no window will be opened if this variable is undefined. Likewise, no window will be opened if the user specifies "" (a blank), "none", or None as the <filename>. If the user wants a Plotter which plots to a given CGM or PostScript file (or one of each), then the user must instantiate one or more Plotter objects using the keyword argument hcp (described below) and hand it to a Graph via the plotter keyword. Eventually this will be changed to make it easier on the user to ask the Graph to plot to a file only.
PyNarcisse: <filename> can be used in two different ways.
(1) As a way to specify a Narcisse process to connect to. In this case, the <filename> should be in the form "machine+port_serveur++user@ie.32" where machine specifies where the display is to take place (e. g., "icf.llnl.gov:0.0"), port_serveur is the port number displayed on the Narcisse GUI, and user is the userid of the person running.
(2) As a filename where Narcisse is to dump its plots. In this case, use the file suffix ".spx" to specify a binary file, or ".spc" for an ascii dump file. If a filename of this form is specified, PyNarcisse attempts a connection to Narcisse using the value of the DEST_SP3 environment variable, if it exists, and if not, attempts to construct a connection filename using DISPLAY environment variable for machine, the value of the PORT_SERVEUR environment variable (or the default 2101 if PORT_SERVEUR is not defined) for port_serveur, and the value of USER for user.

Keyword Arguments

Currently only PyGist Plotters accept keyword arguments; these arguments (with their default values, if not specified) are as follows:

n (0) -- the number of the graphics window (0 to 7 are allowed). each Plotter object corresponds to a separate window.
dpi (100 for 2d; 75 for 3d.) -- the size of the window wanted. 100 and 75 are allowed; 100 is the larger size. This does not affect the size of hardcopy plots.
wait (1) -- used to make sure everything is plotted before changing frames.
private (0) -- use a common colormap (palette) for all windows.
hcp -- if not present, or if set to "", there will be no hardcopy file. If present, names a file unique to this window. This will be PostScript if the <filename> ends in ".ps" and CGM if the <filename> ends in ".cgm". Note that if both <filename> and hcp are "", then you will have a Plotter with no window and no file, a circumstance of doubtful utility.
dump (0) -- if 1, dumps the color palette at the beginning of each page of hardcopy output, otherwise converts to grey scale.
legends (0) -- controls whether (1) or not (0) curve legends are dumped to the hardcopy.
style ("work.gs" for 2d; "nobox.gs" for 3d.) -- name of a Gist style sheet.


The following will create a plotter with a window and a hardcopy file for color plots called talk.ps:

pl = Gist.Plotter (" ", hcp = "talk.ps", dump = 1, dpi = 75)

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

Copyright © 1997,Regents of the University of California. All rights reserved.