T.O.C. Index Bug Report ASCEND IV Home

tkxgraph

NAME

tkxgraph - Draw a graph using Tcl/Tk 8

SYNOPSIS

tkxgraph -- -f file [-f file] [options]

DESCRIPTION

The tkxgraph program draws a graph using Tcl/Tk 8.0 given data read from data files. It can display up to 64 independent data sets using different colors and/or line styles for each set. It annotates the graph with a title, axis labels, grid lines or tick marks, grid labels, and a legend. There are options to control the appearance of most components of the graph. tkxgraph starts a wish (and console on pc's). A Tcl/Tk extension (tkxg) is used to create a persistent graph data structure.
The input format is similar to graph(1G) but differs slightly. The data consists of a number of data sets. Data sets are separated by a blank line. A new data set is also assumed at the start of each input file. A data set consists of an ordered list of points of the form "{directive} X Y". The directive is either "draw" or "move" and can be omitted. If the directive is "draw", a line will be drawn between the previous point and the current point (if a line graph is chosen). Specifying a "move" directive tells tkxgraph not to draw a line between the points. If the directive is omitted, "draw" is assumed for all points in a data set except the first point where "move" is assumed. The "move" directive is used most often to allow discontinuous data in a data set. The name of a data set can be specified by enclosing the name in double quotes on a line by itself in the body of the data set. The trailing double quote is optional. Overall graphing options for the graph can be specified in data files by writing lines of the form "<option>: <value>". The option names are the same as those used for specifying X resources (see below). The option and value must be separated by at bleast one space. An example input file with three data sets is shown below. Note that set three is not named, set two has discontinuous data, and the title of the graph is specified near the top of the file.
TitleText: Sample Data
0.5 7.8
1.0 6.2
"set one
1.5 8.9
"set two"
-3.4 1.4e-3
-2.0 1.9e-2
move -1.0 2.0e-2
-0.65 2.2e-4
2.2 12.8
2.4 -3.3
2.6 -32.2
2.8 -10.3
After tkxgraph has read the data, it will create a new window to graphically display the data. The interface used to specify the size and location of this window depends on the window manager currently in use. Refer to the reference manual of the window manager for details.
Once the window has been opened, all of the data sets will be displayed graphically (subject to the options explained below) with a legend in the upper right corner of the screen. To zoom in on a portion of the graph, depress a mouse button in the window and sweep out a region. (This feature is supported in C, but not in the current Tcl bindings in tkxg.tcl). tkxgraph will then open a new window looking at just that portion of the graph. tkxgraph also presents three control menus in the upper left corner of each window: File, Execute, and View. Windows are closed by selecting Exit from the File button. The File Print button causes a dialog to appear asking about hardcopy (printout) options. These options are described below (none reimplemented yet). (The
.ISave "postscript"
button uses the tk canvas PostScript generation feature and prompts the user for the name of an output file.)
tkxgraph accepts a large number of options most of which can be specified either on the command line or in the data files themselves. The .Xdefaults/.Xresources file is no longer supported. A list of these options is given below. The command line option is specified first with its data file name (if any) in parentheses afterward. Additional options or more standard tk-like names for options are also given in parentheses afterward. The format of the option in the data file is "option: value" where the option name is one specified below.
Some options can only be specified in the X defaults file or in the data files. These options are described below:

AUTHOR

David Harrison University of California and Ben Allan Carnegie Mellon University

LOCAL ENHANCEMENTS

Now accepts input files with one value per line (X-coordinate is no longer required; if none is given integers from 0-n will be used).
New options -nx, -ny allow changing the signs on axes, which is useful for plots with origin desired at the upper left.
The interface is now interactively fully configurable and the rendering engine is user modifiable. The restriction of graph that axes once defined as logarithmic are always logarithmic is no longer imposed. The complete set of configuration parameters is accessible through the View menu. The bulk of the rendering engine is implemented in Tcl procedures so that associations between the xgraph data object and a canvas can be manipulated and the full power of canvas tags may be exploited.
A call to tkxg returns the name of an xgraph created from the input files specified to the command. The xgraph name returned is a Tcl command that can respond to the messages: destroy, configure, cget, plot, and resource. The first such return is always xgraph0, and the trailing digit increases with successive calls. tkxgraph aims to be maximally compatible with the old xgraph, and this causes some inconsistencies in the handling of the old Xresources and the new tk-like switches.

BUGS


- Based on Tcl/Tk 8.0b1, which is buggy.
- Zooming in on graphs doesn't work yet.
- There is no way to produce hardcopy without running tkxgraph interactively.
- There is no way to produce hardcopy except saving to a file.
- The maintainer is ballan@cs.cmu.edu.


Last Modified: 03:22pm EDT, September 30, 1997
9/26/97 Release 0.8 authors T.O.C. Index Bug Report ASCEND IV Home