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 .p, .pl, .plo, or .pls is recommended.
Note that for many uses you don't need to write a script at all.. you can use 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.
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.
The above ploticus script invokes a number of procedures (procs). First, proc areadef to set up a plotting area, then proc xaxis and yaxis to render the axes. Then proc getdata is invoked to define some data, and then finally proc bars is invoked to produce a bar graph.
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 proc areadef
and specified values for these attributes: rectangle, xrange,
All of the procs, as well as the names, types, and acceptable
values for all attributes, are described in the
ploticus scripts handbook.
A typical use of ploticus is to display chronological data. Suppose we have some data in a file called log.dat that has fields count and dt like this:
18 071301 16 071401 15 071501 34 071601 ...etc..Here's a script that will automatically scale to the data and plot the values over time as shown above:
// simple example 2 #proc getdata file: ../pltestsuite/data19 fieldnames: count dt #proc areadef rectangle: 1 1 5 3 xscaletype: date mmddyy xautorange: datafield=dt yautorange: datafield=count incmult=2.0 lowfix=0 xaxis.stubs: inc 1 month xaxis.stubformat: Mmmyy yaxis.stubs: inc #proc lineplot xfield: dt yfield: count linedetails: color=red
A large collection of script examples may be found in the ploticus scripts gallery. One way to proceed is to locate an example that is similar to what you want, and then copy it and play with it.
data display engine
Copyright Steve Grubb
|Ploticus is hosted at http://ploticus.sourceforge.net|