Docs: bargraf

Introduction

Bargraf (E1) utilizes the standard ERPSS graphics user interface and standard graphics commands, as described in the Multiplot User's Manual. Bargraf is a program which plots a bar graph on a display device according to formatting specifications and data which are acquired from an input file. This file is normally created with a text editor such as vi (1), and contains a set of commands that describe the data and the appearance of the graph. It is possible to specify labels and legends to aid in the interpretation of the graph, and to set arbitrary margins on all four sides, although there are defaults which will be automatically employed if these optional parameter specifications do not appear in the input file.

Getting Started

Bargraf is invoked as:

where displaydevice is the abbreviated name of the graphics device one wishes to use (e.g. mxw, las, etc.), and inputfile refers to a file containing the various parameters and data for bargraf. If '-' is specified for the input file, bargraf will read from the standard input (usually the keyboard).

Bargraf is really quite easy to use, but the formal explication of the contents of a data/formatting file is somewhat complex. It is therefore best to look at an example of a data/formatting file and the plot that it generates in order to learn how to use bargraf. In fact, imitation of this example is by far the fastest way to begin using bargraf. The graph generated by the data/formatting file for this example is shown in Figure 1. Here are the verbatim contents of the file which produced the graph in Figure 1.


	group	*Fido	complex textsize=6 thin
		bar	4.0:0.4 fill=3
		bar 	-5.0:0.9 fill=1
		bar	-7.3:1.3 fill=2
		bar	-8.3 fill=17
	group	*Kula	complex textsize=6 thin
		bar	-4.3 fill=3
		bar	7.3 fill=1
		bar	3.1 fill=2
		bar	6.1 fill=17
	group  	"\\(dgChew Biz" complex textsize=6 medium
		bar	6.2 fill=3
		bar	8.1 fill=1
		bar	9.3 fill=2
		bar	23.6 fill=17
	ylabel	kilos/year complex textsize=7 thin
	xlabel	"*--Dry       \\(dg--Can" complex textsize=4 thin
	header "Weight Increase"	complex textsize=9 medium
	header "(German Shepherds Only)" italics textsize=5 thin
	legend	1983 fill=3 complex textsize=5 thin
	legend	1984 fill=1 complex textsize=5 thin
	legend  1985 fill=2 complex textsize=5 thin
	legend	"\\(cs('83-'85)" fill=17 italics textsize=5 thin
	ytickstyle format=2.1 complex textsize=4
	ymax 25.0
	ymin -10.0
	draw
	coord screen
	text .1 .03 "Figure 1." complex textsize=4

While some of the specific arguments may be unclear, the basic format and manner in which bargraf works should be apparent from this example. The remainder of this document simply explains all the possibilities, limitations, and default values for the various statements which comprise a data/formatting file.

Figure 1


The Data/Formatting File

All the data to be graphed as well as parameters controlling the appearance of the plot must be formatted according to the standard ERPSS command conventions, which are described in the Multiplot User's Manual. Many of the bargraf commands use standard options (e.g., "thick", "color=") that are also described in plotcmd (E3p), and which will be abbreviated here as "line_opts" (line style options), "text_opts" (text style options), and "trans_opts" (transformation options).

There are few restrictions on the format of the data/format file, except that there must be at least one group and one bar statement, and that all group and bar specifications must precede any additional commands. The syntax of the group and bar statements is related to the implicit nature of the plots produced by bargraf. Often one wishes to depict data from a number of levels of experimental factors or variables as individual bars, and this is done by using a bar statement and its associated data and parameters for each data value corresponding to each level of that factor. It is often desired, however, to display data along one factor dimension at various levels of another experimental variable or factor; this is the purpose of the group statements. The data/formatting file must start with a group statement and its label, which will be plotted under the group of bars whose specifications follow that group statement in the file. If more than one group of bars is desired, another group statement and its associated bar statements should follow the last bar statement of the previous group statement. There is a maximum of 20 groups, and 100 bars per group. Groups of bars will be separated by more space than bars within each group in the plot. While the design of bargraf (E1) implicitly assumed that the bars in different groups would have similar fill types and represent data corresponding to similar levels of an experimental factor, this is not checked nor enforced in any way by bargraf, thus allowing arbitrary graphs to be generated. See the explication of the legend command below for further information on this point.

Once all group and bar statements are complete at the beginning of the data/formatting file, one may include any of the other commands.

Detailed Keyword Semantics

In addition to the commands listed above, all of the standard graphics commands that are available for multiplot (E1) are also available for bargraf (E1).

Summary of Commands

Commands Specific to Bargraf


	group "label" [text_opts]			(Mandatory)
	bar value[:error] [line_opts] [fill=###]	(Mandatory)
	legend "label" [text_opts] [fill=###]
	title string [text_opts] 
	header string [text_opts]
	xtitle string [text_opts] 
	xlabel string [text_opts]
	ytitle string [text_opts] 
	ylabel string [text_opts]
	ymin value
	ymax value
	nyticks value
	ytickstyle [text_opts] [format=fw.prec]
	barwidth value
	barspace value
	lmargin value
	tmargin value
	rmargin value
	bmargin value
	gridstyle [line_opts]
	draw
	coord screen/graph
	readfile filename [trans_opts]
	rf filename [trans_opts]

Standard graphics commands


	linestyle [line_opts]
	gridstyle [line_opts]
	textstyle [line and text_opts]
	point x y [line_opts]
	line x1 y1 x2 y2 [line_opts]
	moveto x y
	lineto x y [line_opts]
	arrow x1 y1 x2 y2 length angle [line_options]
	arc mid_x mid_y radius start_degrees stop_degrees [line_opts]
	rect left top right bottom [line_opts fill=value]
	startpgon
	endpgon
	drawpgon x y [line_opts fill=value]
	text x y "string" [line and text_opts]
	translate [trans_opts]
	trans [trans_opts]
	vfile filename [trans_opts]


BARGRAF
Tutorial Introduction and Reference Manual
Ronald M. Ohst, June 1987
Steve Luck, August 1991


© 2005 UCSD ERP Lab
Please send comments and suggestions to the ERPSS Webmaster