.ig >>
<STYLE TYPE="text/css">
<!--
        A:link{text-decoration:none}
        A:visited{text-decoration:none}
        A:active{text-decoration:none}
        OL,UL,P,BODY,TD,TR,TH,FORM { font-family: arial,helvetica,sans-serif;; font-size:small; color: #333333; }

        H1 { font-size: x-large; font-family: arial,helvetica,sans-serif; }
        H2 { font-size: large; font-family: arial,helvetica,sans-serif; }
        H3 { font-size: medium; font-family: arial,helvetica,sans-serif; }
        H4 { font-size: small; font-family: arial,helvetica,sans-serif; }
-->
</STYLE>
<title>ploticus: introduction to ploticus scripts</title>
<body bgcolor=D0D0EE vlink=0000FF>
<br>
<br>
<center>
<table cellpadding=2 bgcolor=FFFFFF width=550><tr>
<td>
  <table cellpadding=2 width=550><tr>
  <td><br><h2>Introduction to ploticus scripts</h2></td>
  <td align=right>
  <small>
  <a href="../doc/welcome.html"><img src="../doc/ploticus.gif" border=0></a><br>
  Version 2.41 Mar2009
     </small><br><a href="../doc/scripthome.html">Scripts</a>
  <td></tr></table>
</td></tr>
<td>
<br>
<br>
.>>

.TH Introduction_to_ploticus_scripts PL "11-MAR-2009   PL ploticus.sourceforge.net"

.LP
Ploticus is controlled by scripts that a 
user creates in a text editor and saves in a file.
Script files should be plain ascii text files, and they
may be named anything, however a file name ending of
\fB.p\fR, \fB.pl\fR, \fB.plo\fR, or \fB.pls\fR
is recommended.

.LP
Note that for many uses you don't need to write a script at all.. you can use a
.ig >>
<a href="prefabs.html">
.>>
\0ploticus prefab,
.ig >>
</a>
.>>
and control the plot by supplying some parameters on the command line 
while everything else is handled automatically.  Scripts are useful when
customization is needed, or for doing more sophisticated operations like multiple
plots, overlays, data manipulation and processing, or for graph types where
a prefab doesn't exist.


.ig >>
<br><br><br>
.>>

.SH Simple example
.nf
.ft C
.ig >>
<br><img src="../gallery/simple1.gif"><br>
.>>
\0
\0// simple example 1
\0
\0#proc areadef
\0  rectangle: 1 1 4 2
\0  xrange: 0 5
\0  yrange: 0 100
\0
\0#proc xaxis:
\0  stubs: text
\0	Africa
\0	Americas
\0	Asia
\0	Europe,\\nAustralia,\\n\& Pacific
\0
\0#proc yaxis
\0  label: Growth Rate
\0  stubs: inc 20
\0  minortics: yes
\0  minorticinc: 5
\0
\0#proc getdata
\0  data: 76 
\0	54 
\0	60 
\0	59
\0
\0#proc bars
\0  lenfield: 1
\0  color: teal
\0  barwidth: 0.2
\0
.ft R
.fi

.LP
As you can see, this is not low-level 3GL-style code.  It is a sort of
hybrid; plotting actions (#procs) are specified in procedural order,
but within each #proc the language is goal-driven (4GL).  Thus, traditional
procedural programming skills are not required.
.LP
The above ploticus script invokes a number of procedures (procs).
First,
\fBproc areadef\fR to set up a plotting area, then
\fBproc xaxis\fR and \fByaxis\fR to render the axes.
Then \fBproc getdata\fR is invoked to define some data, 
and then finally \fBproc bars\fR is invoked to produce a bar graph.
.LP
For each proc, the user may specify a various attributes or options.
Attributes that are not specified use a default when possible.
In the above example, the user has invoked \fCproc areadef\fR
and specified values for these attributes: \fCrectangle\fR, \fCxrange\fR,
and \fCyrange\fR.  
All of the procs, as well as the names, types, and acceptable 
values for all attributes, are described in the 
.ig >>
<a href="../doc/scripthome.html">
.>>
\0ploticus scripts handbook.
.ig >>
</a>
.>>

.ig >>
<br><br><br>
.>>

.SH Another example
.ig >>
<br><img src="../gallery/simple2.gif"><br>
.>>
A typical use of ploticus is to display chronological data.
Suppose we have some data in a file called \fClog.dat\fR that has
fields \fCcount\fR and \fCdt\fR like this:
.nf
  18 071301
  16 071401
  15 071501
  34 071601
  ...etc..
.fi
Here's a script that will automatically scale to the data and plot the values 
over time as shown above:
.nf
\0
\0// simple example 2
\0
\0#proc getdata
\0file: ../pltestsuite/data19
\0fieldnames: count dt
\0
\0#proc areadef
\0rectangle: 1 1 5 3
\0xscaletype: date mmddyy
\0xautorange: datafield=dt
\0yautorange: datafield=count incmult=2.0 lowfix=0
\0xaxis.stubs: inc 1 month
\0xaxis.stubformat: Mmmyy
\0yaxis.stubs: inc
\0
\0#proc lineplot
\0xfield: dt
\0yfield: count
\0linedetails: color=red
\0
.fi

.ig >>
<br><br>
.>>

.LP
A large collection of script examples may be found in the
.ig >>
<a href="../gallery/index.html">
.>>
\0ploticus scripts gallery.
.ig >>
</a>
.>>
One way to proceed is to locate an example that is similar to what you
want, and then copy it and play with it.

.LP
.ig >>
<br><br><br>
.>>
.ig >>
<a href="scriptsyntax.html">
.>>
\0Continue to Script Syntax page
.ig >>
</a>
.>>

.LP

.ig >>
<br>
<br>
</td></tr>
<td align=right>
<a href="../doc/welcome.html">
<img src="../doc/ploticus.gif" border=0></a><br><small>data display engine &nbsp; <br>
<a href="../doc/Copyright.html">Copyright Steve Grubb</a>
<br>
<br>
<center>
<img src="../gallery/all.gif"> 
</center>
</td></tr>
</table>
<br>
<center>
<table><tr><td>
Ploticus is hosted at http://ploticus.sourceforge.net</td><td> &nbsp; </td><td>
<a href="http://sourceforge.net/projects/ploticus"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=38453&type=12" 
width="120" height="30" border="0" 
alt="Get ploticus data display engine at SourceForge.net. Fast, secure and Free Open Source software downloads" /></a>
</td></tr></table>


</center>
.>>

