#set TITLE = "Prefabs"
#include top

.SH Available prefabs
.ig >>
<table cellpadding=2 border=1><tr>
<td><a href="prefab_chron.html"><img src="../gallery/prefab_img/chron1thm.gif" border=0></a><br>
<a href="prefab_chron.html">chron</a> - chronological data (dates, times, etc); tabulate by week, month, etc.
</td>
<td><a href="prefab_dist.html"><img src="../gallery/prefab_img/dist1thm.gif" border=0></a><br>
<a href="prefab_dist.html">dist</a> - frequency distribution histogram on a data field
</td>
<td><a href="prefab_lines.html"><img src="../gallery/prefab_img/lines1thm.gif" border=0></a><br>
<a href="prefab_lines.html">lines</a> - line plots with optional data points and error bars, up to 4 groups
</td>
<td><a href="prefab_pie.html"> <img src="../gallery/prefab_img/pie1thm.gif" border=0> </a><br>
<a href="prefab_pie.html">pie</a> - pie graphs
</td>
</tr>
<td><a href="prefab_stack.html"><img src="../gallery/prefab_img/stack1thm.gif" border=0></a><br>
<a href="prefab_stack.html">stack</a> - stacked bar graphs, up to 4 levels</td>
</td>
<td><a href="prefab_scat.html"><img src="../gallery/prefab_img/scat2thm.gif" border=0></a><br>
<a href="prefab_scat.html">scat</a> - scatterplots 
</td>
<td><a href="prefab_vbars.html"><img src="../gallery/prefab_img/vbars2thm.gif" border=0></a><br>
<a href="prefab_vbars.html">vbars</a> - bar graph of 1 or 2 groups with error bars
</td>
<td><a href="prefab_vbars.html"><img src="../gallery/prefab_img/vbars3thm.gif" border=0></a><br>
<a href="prefab_vbars.html">vbars</a> - with error bars only
</td>
</tr>
</table>
<br>
.>>
Also available:
#set FILE = "prefab_draw.html"
#set TAG = "draw"
#include link
, a prefab for interpreting ploticus draw commands.


.SH What are prefabs?
Prefabs are the easiest way to get started with ploticus.
You can quickly generate common types of plots without coding any ploticus scripts.
Just supply several key parameters on the command line or in the data file.
Everything else uses defaults.
.LP
The \fC-prefab\fR command line option tells pl to use a prefab.
Any of the other command options may also be used along with \fC-prefab\fR.
For example, to use the \fBscat\fR scatterplot prefab you might use
a command such as this:
.IP
\fCpl -prefab scat  -png  data=results.dat  x=2  y=4  -scale 0.7\fR
.LP
Prefab scripts are ordinary ploticus scripts.  A collection of prefab scripts
are included with ploticus in the \fC./prefabs\fR directory.
You can use this directory or set up one of your own.
Ploticus must be supplied with the full pathname of the directory where your 
prefab files reside.
This may be hard-coded at build time (settable in the Makefile as PREFABS_DIR),
or via an environment variable called PLOTICUS_PREFABS.
If the environment variable is found it overrides the hard-coded path name.

#include space

.LP
Prefabs are intended to cover common, straightforward situations.
The tradeoff, as usual, is convenience vs. flexibility & power.
Higher degrees of customization
will require that you write a ploticus script, or develop your own prefab
(see CUSTOMIZATION below).


#include space

.SH Parameters
.LP
.LP
Parameters may be supplied on the \fBpl\fR command line as \fIvar=value\fR
pairs as seen in the above example. 
.LP
Some parameters are 
#set FILE = "prefab_stdparms.html"
#set TAG = "standard (recognized by most of the prefabs)"
#include link
; others are specific to individual prefabs, and are
described on the individual prefab man pages.
.LP
If convenient, most parameters may be embedded in an input 
data file, using the #set construct:
.IP
.nf
.ft C
\0#set x = 2
\0#set y = 3
\0#set title = Correlation of WBC vs. T-Chol
.ft R
.fi
.LP
Some parameters cannot be set from within the data file because they control
data scanning.  These are \fCdata\fR, \fCdelim\fR, \fCheader\fR, and \fCcomment\fR.
There may be others as noted for individual prefabs.

#include space

.SH Output file names
.LP
The \fB-o\fR option may be used to specify output file name explicitly.
If \fB-o\fR is not given,
output file naming is similar to that of \fBpl\fR in other contexts.
For the above example the output file would be named \fCscat.png\fR .

#include space
.SH Plot data
Plot data must be located in a file.
The name of the data file is given in the 
#set FILE = "prefab_stdparms.html"
#set TAG = "data= parameter"
#include link
the data field delimitation method may be given in the 
#set FILE = "prefab_stdparms.html"
#set TAG = "delim= parameter"
#include link
\0.  See 
#set FILE = "dataformat.html"
#set TAG = "dataformat"
#include link
for more information on acceptable data formats.
Missing data fields are generally skipped, but this depends
on what kind of plot is being generated. See
#set FILE = "dataformat.html"
#set TAG = "dataformat"
#include link
for more discussion of missing data.

#include space
.SH Customization
.LP
Prefabs allow quick looks at data, but
there are often details that would be nice to control
but can't be adjusted because there is no command line parameter to do so.
One way to proceed is to copy a prefab script to your own directory and
then modify your copy as needed.
Another option is to make a new prefab variant in the prefabs directory.
.LP
If you just want different defaults for a prefab, you can create a shell script
that invokes the prefab as you want it.  Then, 
put a \fC$*\fR at the end of the pl
command to pick up any overrides that the shell script user enters
on the command line (if a parameter is given twice, the rightmost is taken).

.LP
.ig >>
<a name=examples></a>
.>>
#include space
.SH Examples
.LP
All prefab examples are included in the ploticus test suite that is included
with all distributions (2.02 and later).


#include space
.SH Hints
The following 
#set FILE = "pl.1.html#options"
#set TAG = "pl command line options"
#include link
may be very useful with prefabs:
\fB-scale\fR, \fB-color\fR, \fB-backcolor\fR, \fB-tightcrop\fR, \fB-map\fR,
\fB-debug\fR,
and perhaps \fB-font\fR.
.LP
Be careful not to confuse prefab parameters with
#set FILE = "pl.1.html#options"
#set TAG = "pl command line options"
#include link
\0.  Prefab parameters are given this way: \fCparamname=value\fR.
Command line options are given this way: \fC-option\fR or \fC-option value\fR.
.LP
Most shells allow a backslash (\\) for breaking up long commands into two or more lines.
.LP
You can get a multi line title by splitting it over two lines, eg:
.nf
    pl -prefab pie1 data=data1 fld=3 label=1 title="Travel expenditures
    By department
    Fiscal year 2000"
.fi
.LP
#set FILE = clickmap.html
#set TAG = "HTML clickmaps"
#include link
may be generated using the prefab 
#set FILE = "prefab_stdparms.html#clickmapurl"
#set TAG = "clickmapurl standard parameter"
#include link
\0.

#include space

.SH User-contributed prefabs
User-contributed prefabs are welcome and may be sent to \fCscg@jax.org\fR;
please include the prefab script file and a man page giving at least one working example.

#include bottom
